Example #1
0
 public function testWinner()
 {
     $match = $this->getMock('Application\\Model\\Entity\\PlannedMatch');
     $this->plannedMatch->winnerPlaysInMatchAt($match, 1);
     $this->assertEquals(1, $this->plannedMatch->getMatchIndexForWinner());
     $this->assertSame($match, $this->plannedMatch->getMatchForWinner());
 }
Example #2
0
 /**
  * @param PlannedMatch $plannedMatch
  * @param Match  $match
  */
 public function matchPlayed(Match $match, PlannedMatch $plannedMatch = null)
 {
     $plannedMatch->matchPlayed($match);
     $winner = $plannedMatch->getTeam($match->getWinner() - 1);
     if ($plannedMatch->isFinal()) {
         $this->winner = $winner;
         $second = $plannedMatch->getTeam($match->getLooser() - 1);
         $this->second = $second;
         $this->end = new \DateTime();
     } else {
         $plannedMatch->getMatchForWinner()->setTeam($winner, $plannedMatch->getMatchIndexForWinner());
     }
 }