Exemplo n.º 1
0
 public function testHit()
 {
     $firstLifespan = $this->game->getPlayer()->getLifespan();
     $this->drone->hit($this->game->getPlayer());
     $secondLifespan = $this->game->getPlayer()->getLifespan();
     $this->assertLessThan($firstLifespan, $secondLifespan);
 }
Exemplo n.º 2
0
 /**
  * @depends testHeal
  */
 public function testBeforeTakeHit()
 {
     $this->game->getCharacterPool()->searchBee()->takeHit(100);
     $expected = $this->game->getCharacterPool()->searchBee()->getLifespan();
     $this->game->getCharacterPool()->searchBee()->beforeTakeHit();
     $actual = $this->game->getCharacterPool()->searchBee()->getLifespan();
     $this->assertGreaterThan($expected, $actual);
 }
Exemplo n.º 3
0
 public function testBeforeTakeHit()
 {
     /** @var Worker $bee */
     $bee = $this->game->getCharacterPool()->searchBee();
     $expected = $this->game->getHoneyPool()->amount();
     $bee->beforeTakeHit();
     $actual = $this->game->getHoneyPool()->amount();
     $this->assertGreaterThan($expected, $actual);
 }
Exemplo n.º 4
0
 public function testFinishStartedGameWithBeesAndEmptyPlayerReturnLose()
 {
     $this->game->getCharacterPool()->addBee(new Drone($this->game));
     $this->game->start();
     $this->game->getPlayer()->toDie();
     $this->assertEquals(GameResultInterface::RESULT_LOSE, $this->game->finish());
 }
Exemplo n.º 5
0
 public function testKillAll()
 {
     $this->queen->killAllBees();
     $this->assertCount(0, $this->game->getCharacterPool()->getBees());
 }
Exemplo n.º 6
0
 /**
  * @depends testGet
  */
 public function testSave()
 {
     $this->game->getCharacterPool()->killAllBees();
     $this->sessionStub->expects($this->once())->method('set')->with('game', serialize($this->game))->willReturn(true);
     $this->storage->save($this->game);
 }
Exemplo n.º 7
0
 public static function setUpBeforeClass()
 {
     self::$game = GameWithoutCharacters::get();
     self::$pool = self::$game->getCharacterPool();
 }