Ejemplo n.º 1
0
 protected function setUp()
 {
     $this->feed = new FeedContent();
     $this->feed->setPublicId('feed id');
     $this->feed->setLink('http://example.com');
     $this->feed->setTitle('feed title');
     $this->feed->setDescription('feed subtitle');
     $this->feed->setLastModified(new \DateTime());
     $item = new Item();
     $item->setPublicId('item id');
     $item->setLink('http://example.com/1');
     $item->setSummary('lorem ipsum');
     $item->setTitle('title 1');
     $item->setUpdated(new \DateTime());
     $item->setComment('http://linktothecomments.com');
     $item->setAuthor('Contributor');
     $media = new Media();
     $media->setUrl('http://media');
     $media->setUrl('image/jpeg');
     $item->addMedia($media);
     $this->feed->addItem($item);
 }
 /**
  * @param array $options
  *
  * @return FeedContent
  *
  * @throws FeedNotFoundException
  */
 public function getFeedContent(array $options)
 {
     $content = new FeedContent();
     $id = array_key_exists('id', $options) ? $options['id'] : null;
     if ($id === 'not-found') {
         throw new FeedNotFoundException();
     }
     $content->setPublicId($id);
     $content->setTitle('thank you for using RssAtomBundle');
     $content->setDescription('this is the mock FeedContent');
     $content->setLink('https://raw.github.com/alexdebril/rss-atom-bundle/');
     $content->setLastModified(new \DateTime());
     $item = new Item();
     $item->setPublicId('1');
     $item->setLink('https://raw.github.com/alexdebril/rss-atom-bundle/somelink');
     $item->setTitle('This is an item');
     $item->setSummary('this stream was generated using the MockProvider class');
     $item->setDescription('lorem ipsum ....');
     $item->setUpdated(new \DateTime());
     $item->setComment('http://example.com/comments');
     $item->setAuthor('Contributor');
     $content->addItem($item);
     return $content;
 }