Esempio n. 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();
 }
Esempio n. 2
0
 /**
  * @depends testToDieWith1BeeInPoolReturnWin
  */
 public function testToDieWith2BeesInPoolReturnNotFinishedAndCountBeesInPoolEqualsOne()
 {
     $this->game->getCharacterPool()->addBee(new BeeChild($this->game));
     $this->game->getCharacterPool()->addBee(new BeeChild($this->game));
     $this->game->start();
     $this->game->getCharacterPool()->searchBee()->toDie();
     $this->assertFalse($this->game->isFinished());
     $this->assertEquals(1, count($this->game->getCharacterPool()->getBees()));
 }
Esempio n. 3
0
 public function actionStart()
 {
     if ($this->game->isFinished()) {
         return $this->redirect('/game/finished');
     }
     if ($this->game->isStarted()) {
         return $this->redirect('/game/overview');
     }
     $this->game->start();
     if ($this->game->isStarted()) {
         $this->session->set('started', true);
         $this->storage->save($this->game);
         return $this->redirect('/game/overview');
     }
 }