Example #1
0
 public function testDraw()
 {
     $fixture = new Fixture();
     $fixture->resetScoreHome();
     $fixture->resetScoreAway();
     $this->assertTrue($fixture->isDraw());
 }
 /**
  * @param Fixture $fixture
  *
  * @throws MatchException
  */
 public function evaluateMinuteOfMatch(Fixture $fixture)
 {
     if (!$fixture->hasTeamHome()) {
         throw new MatchException('no home team');
     }
     if (!$fixture->hasTeamAway()) {
         throw new MatchException('no away team');
     }
     $fixture->incrementMinutesPlayed();
     if (null === $fixture->getScoreHome()) {
         $fixture->resetScoreHome();
     }
     if (null === $fixture->getScoreAway()) {
         $fixture->resetScoreAway();
     }
     if ($this->happensEvent()) {
         $fixture->addEvent($this->createRandomEvent($fixture));
     }
 }