NL
games/runtime-demo / tests / SamplesTest.php · commit 459a354
<?phpnamespace Tests;use JumPHP\Testing\GameTestCase;/** The samples of the extension (extensions/runtime/doc/samples/*.php) run: a scene each, some frames, no error. Keep one sample per thing it does. */final class SamplesTest extends GameTestCase{    public function testEverySampleRuns(): void    {        $files = glob(dirname(__DIR__, 3) . '/extensions/runtime/doc/samples/*.php') ?: [];        self::assertNotEmpty($files, 'the extension has at least one sample');        foreach ($files as $file) {            require_once $file;            $class = 'App\\Extensions\\Runtime\\' . basename($file, '.php');            self::assertTrue(defined($class . '::LABEL'), "$class says what it shows (LABEL)");            $this->game->start($class);            $this->game->run(90);            self::assertInstanceOf($class, $this->game->scene(), $class);        }    }}