| @@ 40-55 (lines=16) @@ | ||
| 37 | * @return FeedInterface |
|
| 38 | * @throws FeedNotFoundException |
|
| 39 | */ |
|
| 40 | protected function buildFeed(string $id): FeedInterface |
|
| 41 | { |
|
| 42 | if ($id === 'not-found') { |
|
| 43 | throw new FeedNotFoundException(); |
|
| 44 | } |
|
| 45 | ||
| 46 | $feed = new Feed(); |
|
| 47 | ||
| 48 | $feed->setPublicId($id); |
|
| 49 | $feed->setTitle('thank you for using RssAtomBundle'); |
|
| 50 | $feed->setDescription('this is the mock FeedContent'); |
|
| 51 | $feed->setLink('https://raw.github.com/alexdebril/rss-atom-bundle/'); |
|
| 52 | $feed->setLastModified(new \DateTime()); |
|
| 53 | ||
| 54 | return $this->addItem($feed); |
|
| 55 | } |
|
| 56 | ||
| 57 | /** |
|
| 58 | * @param Feed $feed |
|
| @@ 62-75 (lines=14) @@ | ||
| 59 | * @return FeedInterface |
|
| 60 | * @throws \Exception |
|
| 61 | */ |
|
| 62 | protected function addItem(Feed $feed) : FeedInterface |
|
| 63 | { |
|
| 64 | $item = new Item(); |
|
| 65 | ||
| 66 | $item->setPublicId('1'); |
|
| 67 | $item->setLink('https://raw.github.com/alexdebril/rss-atom-bundle/somelink'); |
|
| 68 | $item->setTitle('This is an item'); |
|
| 69 | $item->setDescription('this stream was generated using the MockProvider class'); |
|
| 70 | $item->setLastModified(new \DateTime()); |
|
| 71 | ||
| 72 | $feed->add($item); |
|
| 73 | ||
| 74 | return $feed; |
|
| 75 | } |
|
| 76 | } |
|
| 77 | ||