/** * Return the configured Scraper * @param ServiceLocatorInterface $serviceLocator * @return Scraper */ public function createService(ServiceLocatorInterface $serviceLocator) { $config = $serviceLocator->get('NetglueTripAdvisor\\ScraperOptions'); $scraper = new Scraper($config); $cache = $serviceLocator->get('NetglueTripAdvisor\\Cache'); $scraper->setCache($cache); return $scraper; }
public function testSetOptionsAcceptsTraversable() { $options = new \ArrayObject(array('url' => 'http://example.com/foo.html')); $scraper = new Scraper($options); $this->assertInstanceOf('NetglueTripAdvisor\\ScraperOptions', $scraper->getOptions()); $this->assertSame('http://example.com/foo.html', $scraper->getOptions()->getUrl()); }