/**
  * @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));
     }
 }
Example #2
0
 public function testNoScoreBeforeMatchStart()
 {
     $fixture = new Fixture();
     $this->assertNull($fixture->getScoreHome());
     $this->assertNull($fixture->getScoreAway());
 }