Example #1
0
 /**
  * @param AbstractTournament $tournament
  * @param PlannedMatch       $plannedMatch
  *
  * @return MatchForm
  */
 public function getMatchForm(AbstractTournament $tournament, PlannedMatch $plannedMatch = null)
 {
     $gamesPerMatch = $tournament->getMinimumNumberOfGames();
     if ($tournament->getTeamType() == $tournament::TYPE_SINGLE) {
         $form = new MatchFormSingle($this->playerRepository, $gamesPerMatch, $tournament->getMaxScore());
     } else {
         if ($plannedMatch == null) {
             $form = new MatchFormDouble($this->playerRepository, $gamesPerMatch, $tournament->getMaxScore(), $tournament->getPlayers());
         } else {
             $form = new MatchFormDouble($this->playerRepository, $gamesPerMatch, $tournament->getMaxScore(), array());
             $form->setTeamOne($plannedMatch->getTeam1());
             $form->setTeamTwo($plannedMatch->getTeam2());
         }
     }
     return $form;
 }
Example #2
0
 public function testConstructor()
 {
     $team1 = $this->getMock('Application\\Model\\Entity\\Team');
     $team2 = $this->getMock('Application\\Model\\Entity\\Team');
     $plannedMatch = new PlannedMatch($team1, $team2);
     $this->assertSame($team1, $plannedMatch->getTeam1());
     $this->assertSame($team2, $plannedMatch->getTeam2());
 }