/**
  * @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));
     }
 }
 public function testGetGoalEvents()
 {
     $team1 = new Team();
     $team1->setId(1);
     $team2 = new Team();
     $team2->setId(2);
     $fixture = new Fixture();
     $fixture->setTeamHome($team1);
     $fixture->setTeamAway($team2);
     $fixture->addEvent(Event::createGoal($fixture, $team1, new Player(), 1));
     $fixture->addEvent(Event::createChance($fixture, $team2, new Player(), 2));
     $this->assertCount(1, $fixture->getGoalEvents());
 }