Exemplo n.º 1
0
 public function testScrapeNextAsync()
 {
     $entity = new ScraperEntity();
     $url = 'http://www.treehouse.nl';
     $this->crawler->expects($this->once())->method('getNextUrls')->will($this->returnValue([$url]));
     /** @var \PHPUnit_Framework_MockObject_MockObject|Scraper $scraper */
     $scraper = $this->getMockBuilder(Scraper::class)->setConstructorArgs([$this->crawler, $this->parser, $this->handler])->setMethods(['scrapeAfter'])->getMock();
     $scraper->expects($this->once())->method('scrapeAfter')->with($entity, $url, $this->greaterThanOrEqual(new \DateTime()));
     $scraper->setAsync(true);
     $scraper->scrapeNext($entity);
 }