Пример #1
0
 public function testScrapeItemSuccess()
 {
     $source = new SourceMock(1234);
     $this->crawler->expects($this->once())->method('getNextUrls')->will($this->returnValue([]));
     $this->handler->expects($this->once())->method('handle')->will($this->returnValue($source));
     $this->dispatcher->expects($this->once())->method('dispatch')->with(ScraperEvents::ITEM_SUCCESS, $this->callback(function (SuccessItemEvent $event) use($source) {
         return $event->getResult() === $source;
     }));
     $this->scraper->scrape(new ScraperEntity(), 'http://example.org');
 }