Exemple #1
0
 /**
  * @param $seasonUrl
  */
 private function importSeason($seasonUrl)
 {
     if (!$this->yearIsValidInSeasonUrl($seasonUrl)) {
         return;
     }
     echo 'Season: ' . $seasonUrl . PHP_EOL;
     $content = file_get_contents($seasonUrl);
     $seasonTournamentUrls = BvbInfoScraper::getSeasonTournamentUrls($content);
     $this->importSeasonTournamentUrls($seasonTournamentUrls);
 }
 public function testGetMatchesWithForfeit()
 {
     $content = file_get_contents(__DIR__ . '/2015ManhattanTournament.html');
     $matches = BvbInfoScraper::getMatches($content);
     $this->assertSame(103, count($matches));
     $this->verifyMatch($matches[40], new Player(6908, 'Paul Araiza'), new Player(10333, 'Alejandro Parra'), new Player(11236, 'Michael Boag'), new Player(6277, 'Dan Newman'), '21-19', '19-21', '19-17');
     $this->verifyMatch($matches[41], new Player(10332, 'Adam Cabbage'), new Player(13455, 'Jake Rosener'), new Player(2457, 'Matt Heagy'), new Player(13522, 'Jorge Martinez'), 'forfeit', '', '');
     $this->verifyMatch($matches[42], new Player(8143, 'Hawk Hatcher'), new Player(14828, 'Clay Paullin'), new Player(6274, 'Robert deAurora'), new Player(10199, 'Ozz Borges'), '21-15', '21-17', '');
     $this->verifyMatch($matches[43], new Player(2035, 'John Moran'), new Player(4825, 'Gregg Weaver'), new Player(15804, 'Michael Brunsting'), new Player(9301, 'Hylas Smith'), '21-18', '21-17', '');
 }
 public function xtestImportFromTournament()
 {
     $content = file_get_contents(__DIR__ . '/../2015ManhattanTournament.html');
     $matches = BvbInfoScraper::getMatches($content);
     $this->setCountLogger();
     $importResult = $this->matchImporter->import($matches);
     $this->assertTrue($importResult instanceof MatchImportResult);
     $this->assertSame(103, $importResult->getSuccessCount());
     $this->assertSame(0, $importResult->getFailedCount());
     $this->assertSame(1394, $this->getTotalQueries());
 }