Ejemplo n.º 1
0
 public function testNotPlayedBy()
 {
     $player1 = new Player();
     $player2 = new Player();
     $player3 = new Player();
     $this->match->setPlayer1($player1);
     $this->match->setPlayer2($player2);
     $this->assertFalse($this->match->isPlayedBy($player1, $player3));
 }
Ejemplo n.º 2
0
 /**
  * Creates a new match
  *
  * @param AbstractTournament $tournament
  * @param Player             $player1
  * @param Player             $player2
  *
  * @return Match
  */
 public function getNew(AbstractTournament $tournament, $player1 = null, $player2 = null)
 {
     if ($tournament->getTeamType() == $tournament::TYPE_SINGLE) {
         $match = new SingleMatch();
         $match->setPlayer1($player1);
         $match->setPlayer2($player2);
     } else {
         $match = new DoubleMatch();
     }
     $gamesPerMatch = $tournament->getMinimumNumberOfGames();
     for ($i = 0; $i < $gamesPerMatch; $i++) {
         $match->addGame(new Game());
     }
     $match->setDate(new \DateTime());
     $match->setTournament($tournament);
     return $match;
 }