Sign in
EN
games/webrtc-demo / tests / SamplesTest.php · commit 87ad512
<?phpnamespace Tests;use JumPHP\Testing\GameTestCase;/** The samples of the extension (extensions/webrtc/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/webrtc/doc/samples/*.php') ?: [];        if ($files === []) {            self::markTestSkipped('the extension\'s folder is not here (the published game holds only games/webrtc-demo/)');        }        foreach ($files as $file) {            require_once $file;            $class = 'App\\Extensions\\Webrtc\\' . 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);        }    }}