From b4aab693043b130cc13f97fd1a8566604b17be4f Mon Sep 17 00:00:00 2001 From: Marco Nassabain Date: Tue, 16 Mar 2021 23:02:50 +0100 Subject: =?UTF-8?q?=E2=9C=85=20FeedFetcher:=20update=20tests=20to=20includ?= =?UTF-8?q?e=20categories?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marco Nassabain --- tests/Unit/Fetcher/FeedFetcherTest.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/Unit/Fetcher/FeedFetcherTest.php b/tests/Unit/Fetcher/FeedFetcherTest.php index ead4a67eb..534d48fc5 100644 --- a/tests/Unit/Fetcher/FeedFetcherTest.php +++ b/tests/Unit/Fetcher/FeedFetcherTest.php @@ -18,6 +18,7 @@ use Favicon\Favicon; use FeedIo\Adapter\ResponseInterface; use FeedIo\Feed\Item\Author; use FeedIo\Feed\Item\MediaInterface; +use FeedIo\Feed\Node\Category; use FeedIo\Feed\ItemInterface; use FeedIo\FeedInterface; use FeedIo\FeedIo; @@ -212,6 +213,11 @@ class FeedFetcherTest extends TestCase $this->author->setName('<boogieman'); $this->enclosure = 'http://enclosure.you'; + $category = new Category(); + $category->setLabel('food'); + $this->categories = new \ArrayIterator([$category]); + $this->categoriesJson = json_encode(['food']); + $this->feed_title = '<a>&its a</a> title'; $this->feed_link = 'http://tests/'; $this->feed_image = '/an/image'; @@ -575,6 +581,9 @@ class FeedFetcherTest extends TestCase $this->item_mock->expects($this->exactly(1)) ->method('getAuthor') ->will($this->returnValue($this->author)); + $this->item_mock->expects($this->exactly(1)) + ->method('getCategories') + ->will($this->returnValue($this->categories)); $item = new Item(); @@ -587,7 +596,8 @@ class FeedFetcherTest extends TestCase ->setRtl(false) ->setLastModified(3) ->setPubDate(3) - ->setAuthor(html_entity_decode($this->author->getName())); + ->setAuthor(html_entity_decode($this->author->getName())) + ->setCategoriesJson($this->categoriesJson); if ($enclosureType === 'audio/ogg' || $enclosureType === 'video/ogg') { $media = $this->getMockbuilder(MediaInterface::class)->getMock(); -- cgit v1.2.3