Exemplo n.º 1
0
 private function getNextGame($parser)
 {
     $reader = Reader::forParser($parser);
     $games = $reader->get()->sortBy(function ($game) {
         return $game->startUtc->timestamp;
     });
     $laterGames = $games->filter(function ($game) {
         return $game->startUtc > Carbon::now('UTC');
     });
     if ($laterGames->isEmpty()) {
         return $games->last();
     }
     return $laterGames->first();
 }
Exemplo n.º 2
0
 /** @test */
 public function it_fetches_and_parses_womens_hockey_games()
 {
     $reader = Reader::forParser(new WomensHockeyParser());
     $data = $reader->get();
     $this->assertNotEquals($data->count(), 0);
 }