Пример #1
0
 /**
  * @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();
 }
Пример #2
0
 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]);
 }