Пример #1
0
 public function testSendMoney()
 {
     $this->team->setMoney(1000);
     $targetTeam = new Team();
     $this->team->sendMoney($targetTeam, 500);
     $this->assertEquals(500, $this->team->getMoney());
     $this->assertEquals(500, $targetTeam->getMoney());
 }
Пример #2
0
 /**
  * @param string $name
  * @param int $money
  */
 private function createTeam($name, $money)
 {
     $team = new Team();
     $team->setName($name);
     $team->setMoney($money);
     /** @var League $league */
     $league = $this->getReference('league1');
     $team->setLeague($league);
     $this->manager->persist($team);
     $this->addReference('team' . $this->teamCounter++, $team);
 }
Пример #3
0
 public function testSelectBestFittingPlayer()
 {
     $team = new Team();
     $team->setId(1);
     $team->setMoney(10);
     $this->manager->setTeam($team);
     $player1 = new Player();
     $player1->setId(1);
     $player1->setTeam($team);
     $player1->setSkillDefense(10);
     $players = array($player1);
     $this->assertNull($this->manager->selectBestFittingPlayer($players));
     $player2 = new Player();
     $player2->setId(2);
     $player2->setSkillDefense(10);
     $players[] = $player2;
     $this->assertEquals($player2, $this->manager->selectBestFittingPlayer($players));
 }
 /**
  * @param int $money
  *
  * @return Team
  */
 private function createTeam($money)
 {
     $team = new Team();
     $team->setMoney($money);
     for ($i = 1; $i <= 20; $i++) {
         $team->addPlayer(new Player());
     }
     return $team;
 }