/** * @expectedException \frontend\exceptions\FinishedGameException */ public function testHitAlreadyFinishedGame_result_Exception() { $this->game->getCharacterPool()->addBee(new Drone($this->game)); $this->game->start(); $this->game->getCharacterPool()->killAllBees(); $this->game->finish(); $this->game->hit(); }
public function actionHit() { if (!$this->game->isStarted()) { return $this->redirect('/game/index'); } if ($this->game->isFinished()) { return $this->redirect('/game/finished'); } $this->game->hit(); $this->storage->save($this->game); if ($this->game->isFinished()) { return $this->redirect('/game/finished'); } return $this->redirect('/game/overview', ['game' => $this->game]); }