Ejemplo n.º 1
0
 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());
 }
Ejemplo n.º 2
0
 /**
  * @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->importRegistry->getFeedType($feed->getType());
     $options = array_merge($options, $feed->getOptions());
     return $builder->build($type, $reader, $options);
 }
 /**
  * @param Feed   $feedEntity
  * @param string $name       The fixture name
  * @param string $feedType   The feed type
  *
  * @throws \RuntimeException
  *
  * @return ItemBag
  */
 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);
     if (null === ($item = $feed->getNextItem())) {
         throw new \RuntimeException('Expecting a non-filtered feed item, got nothing.');
     }
     return $item;
 }