KO

Slave Rift

tueb2024 제작 · 슈팅
5.0 (1)
▶ 플레이 💬 후기 소스 🕘 버전 편집 GitHub
games/slave-rift / tests / GameSmokeTest.php · commit 9ea6094
<?phpnamespace App\Tests;use App\Input\WheelInputManager;use App\Scene\PlayScene;use JumPHP\Input\InputManager;use JumPHP\Testing\GameTestCase;final class GameSmokeTest extends GameTestCase{    public function testInjectedInputManagerMatchesEngineContract(): void    {        $input = $this->game->engine->input;        self::assertInstanceOf(InputManager::class, $input);        self::assertInstanceOf(WheelInputManager::class, $input);        foreach (['poll', 'endFrame', 'pressKey', 'getKeyboard', 'getMouse', 'getTouch', 'getGamepad', 'getActions'] as $method) {            self::assertTrue(method_exists($input, $method), 'Injected InputManager must provide ' . $method . '().');        }    }    public function testDemoSpawnsAndFires(): void    {        $this->game->start(PlayScene::class, ['demo'=>true, 'seed'=>1337]);        $this->game->run(600);        $run = $this->game->peek('run');        self::assertGreaterThan(3.0, $run->time);        self::assertGreaterThan(0, $run->shots);        self::assertGreaterThan(0, $run->kills);        self::assertGreaterThan(0, $run->score);        self::assertLessThanOrEqual(48, count($run->enemies));        $this->game->shot('survival-demo');    }    public function testUpgradeInputAndRestart(): void    {        $this->game->start(PlayScene::class, ['seed'=>1337]);        $run = $this->game->peek('run');        $run->xp = 6;        $this->game->run(2);        self::assertSame('upgrade', $run->state);        $this->game->press('upgrade_one',2);        self::assertSame('play', $run->state);        $run->health = 0;        $this->game->run(2);        self::assertSame('dead', $run->state);        $this->game->press('restart',2);        self::assertSame('play',$this->game->peek('run')->state);        self::assertSame(100,$this->game->peek('run')->health);    }}