/** * @param Scraper $scraper * @param string $parserType * @param string $fixtureName * * @return ScrapedItemBag */ protected function getExpectedItemFixture(Scraper $scraper, $parserType, $fixtureName) { $refl = new \ReflectionClass(get_class($this)); $phpFile = sprintf('%s/fixtures/%s/%s.php', dirname($refl->getFilename()), $parserType, $fixtureName); /** @var array $expected */ $expected = (include $phpFile); $item = new ScrapedItemBag($scraper, static::$url, ''); $item->add($expected['item']); if (isset($expected['id'])) { $item->setOriginalId($expected['id']); } if (isset($expected['url'])) { $item->setOriginalUrl($expected['url']); } if (isset($expected['date'])) { $item->setDatetimeModified($expected['date']); } return $item; }