Пример #1
0
 /**
  * @param Team $team
  */
 public function setTeam(Team $team)
 {
     if (null === $this->team || !$this->team->equals($team)) {
         $this->team = $team;
         $this->team->addPlayer($this);
     }
 }
Пример #2
0
 public function testHandleTrainingWithoutTrainer()
 {
     $this->team->addPlayer(new Player());
     $this->team->train();
     $players = $this->team->getPlayers();
     $this->assertEquals(0, $players[0]->getTrainingValueDefense());
     $this->assertEquals(0, $players[0]->getTrainingValueOffense());
 }
Пример #3
0
 public function testZeroScoreAfterMatchStart()
 {
     $fixture = new Fixture();
     $team1 = new Team();
     $team1->setId(1);
     $team1->addPlayer(new Player());
     $team2 = new Team();
     $team2->setId(2);
     $team2->addPlayer(new Player());
     $fixture->setTeamHome($team1);
     $fixture->setTeamAway($team2);
     $matchEvaluationService = new MatchEvaluationService();
     $matchEvaluationService->evaluateMinuteOfMatch($fixture);
     $this->assertNotNull($fixture->getScoreHome());
     $this->assertNotNull($fixture->getScoreAway());
 }
 /**
  * @param int $id
  *
  * @return Team
  */
 private function createTeam($id)
 {
     $team = new Team();
     $team->setId($id);
     $team->addPlayer(new Player());
     return $team;
 }
 /**
  * @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;
 }