game->start(MainScene::class, ['screen' => 'demo', 'demoNo' => 0]); $player = $this->game->peek('player'); $this->assertTrue($player !== null, 'player should exist'); $this->game->run(60); $this->assertTrue($player->visible, 'player should be visible after demo starts'); } public function testChaserExists(): void { $this->game->start(MainScene::class, ['screen' => 'demo', 'demoNo' => 0]); $chaser = $this->game->peek('chaser'); $this->assertNotNull($chaser, 'chaser should exist'); $this->assertTrue($chaser->drawn, 'chaser should be drawn'); } public function testMenuWorks(): void { $this->game->start(MainScene::class, ['screen' => 'attract']); $this->game->press('fire', 1); $this->assertTrue($this->game->scene()->screenId === MainScene::SCR_MENU, 'should go to menu'); $this->game->press('left', 1); $this->assertNotNull($this->game->scene(), 'menu should exist'); } public function testPlayStarts(): void { $this->game->start(MainScene::class, ['screen' => 'play']); $this->assertNotNull($this->game->game, 'game should be created'); $this->assertNotNull($this->game->game->player, 'player should be created'); } }