/**
  * @param GameDateEvent $event
  */
 public function execute(GameDateEvent $event)
 {
     $matches = $this->fixtureRepository->findByGameDate($event->getGameDate());
     foreach ($matches as $match) {
         $this->lineupService->createFixtureLineup($match);
         $this->matchEvaluationService->evaluateCompleteMatch($match);
     }
 }
Beispiel #2
0
 public function testZeroScoreAfterMatchStart()
 {
     $fixture = new Fixture();
     $team1 = new Team();
     $team1->setId(1);
     $team1->addPlayer(new Player());
     $team2 = new Team();
     $team2->setId(2);
     $team2->addPlayer(new Player());
     $fixture->setTeamHome($team1);
     $fixture->setTeamAway($team2);
     $matchEvaluationService = new MatchEvaluationService();
     $matchEvaluationService->evaluateMinuteOfMatch($fixture);
     $this->assertNotNull($fixture->getScoreHome());
     $this->assertNotNull($fixture->getScoreAway());
 }
 public function testPointsAndGoalsForLeague()
 {
     $team1 = $this->createTeam(1);
     $team2 = $this->createTeam(2);
     $fixture = $this->createFixture($team1, $team2);
     $this->assertEquals(0, $team1->getPoints());
     $this->assertEquals(0, $team1->getGoalsFor());
     $this->assertEquals(0, $team1->getGoalsAgainst());
     $this->assertEquals(0, $team2->getPoints());
     $this->assertEquals(0, $team2->getGoalsFor());
     $this->assertEquals(0, $team2->getGoalsAgainst());
     $this->matchEvaluationService->evaluateCompleteMatch($fixture);
     $this->assertEquals(1, $team1->getPoints());
     $this->assertEquals(0, $team1->getGoalsFor());
     $this->assertEquals(0, $team1->getGoalsAgainst());
     $this->assertEquals(1, $team2->getPoints());
     $this->assertEquals(0, $team2->getGoalsFor());
     $this->assertEquals(0, $team2->getGoalsAgainst());
 }