public function testModifierAddedToFeed() { $type = $this->getFeedTypeMock(); $reader = $this->getReaderMock(); $modifier = $this->getModifierMock(); $this->builder->addModifier($modifier); $feed = $this->builder->build($type, $reader); $this->assertSame(1, sizeof($feed->getModifiers())); $this->assertContains($modifier, $feed->getModifiers()); }
/** * @param Feed $feedEntity * @param string $name The fixture name * @param string $feedType The feed type * * @return FeedItemBag * @throws \RuntimeException */ protected function getActualItemFixture(Feed $feedEntity, $name, $feedType) { $type = $this->getImportRegistry()->getFeedType($feedType); $dispatcher = $this->createEventDispatcher(); $options = $this->getReaderTypeOptions($feedEntity); $reader = $this->createReader($feedEntity, $name, $dispatcher, $options); $builder = new FeedBuilder($dispatcher); $options = $this->getFeedTypeOptions($feedEntity); $feed = $builder->build($type, $reader, $options); /** @var FeedItemBag $item */ if (null === ($item = $feed->getNextItem())) { throw new \RuntimeException('Expecting a non-filtered feed item, got nothing.'); } return $item; }
/** * @param FeedEntity $feed * @param ReaderInterface $reader * @param EventDispatcherInterface $dispatcher * @param array $options * * @return Feed */ protected function createFeed(FeedEntity $feed, ReaderInterface $reader, EventDispatcherInterface $dispatcher, array $options = []) { $builder = new FeedBuilder($dispatcher); $type = $this->registry->getFeedType($feed->getType()); $options = array_merge($options, $feed->getOptions()); return $builder->build($type, $reader, $options); }