Esempio n. 1
0
 public function testChangeContinueOnModificationException()
 {
     $feed = new Feed($this->reader);
     $feed->getEventDispatcher()->addListener(FeedEvents::ITEM_MODIFICATION_FAILED, function (FailedItemModificationEvent $e) {
         $e->setContinue(false);
     });
     $feed->addModifier(new CallbackTransformer(function () {
         throw new ModificationException();
     }), 1, true);
     $this->assertNull($feed->getNextItem(), 'The modification should have not continued');
 }
Esempio n. 2
0
 /**
  * @param ReaderInterface          $reader
  * @param EventDispatcherInterface $dispatcher
  * @param string                   $itemName
  *
  * @return Feed
  */
 protected function createFeed(ReaderInterface $reader, EventDispatcherInterface $dispatcher, $itemName)
 {
     if ($reader instanceof XmlReader) {
         $reader->setNodeCallback($itemName);
     }
     $feed = new Feed($reader, $dispatcher);
     /** @var ModifierInterface $modifier */
     foreach ($this->modifiers as $position => list($modifier, $continue)) {
         $feed->addModifier($modifier, $position, $continue);
     }
     return $feed;
 }