From dda579ccaac67b5f360af98926a1697389bdbc6c Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Fri, 13 Sep 2013 17:59:16 +0200 Subject: also store feeds per article when doing updates --- tests/unit/businesslayer/FeedBusinessLayerTest.php | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'tests') diff --git a/tests/unit/businesslayer/FeedBusinessLayerTest.php b/tests/unit/businesslayer/FeedBusinessLayerTest.php index 17222c57b..550f37dcb 100644 --- a/tests/unit/businesslayer/FeedBusinessLayerTest.php +++ b/tests/unit/businesslayer/FeedBusinessLayerTest.php @@ -173,6 +173,7 @@ class FeedBusinessLayerTest extends \OCA\AppFramework\Utility\TestUtility { $this->assertEquals($feed->getFolderId(), $folderId); $this->assertEquals($feed->getUrl(), $url); + $this->assertEquals($feed->getArticlesPerUpdate(), 2); } @@ -240,6 +241,7 @@ class FeedBusinessLayerTest extends \OCA\AppFramework\Utility\TestUtility { $feed = new Feed(); $feed->setId(3); $feed->getUrl('test'); + $feed->setArticlesPerUpdate(1); $feed->setUrlHash('yo'); $item = new Item(); @@ -286,6 +288,43 @@ class FeedBusinessLayerTest extends \OCA\AppFramework\Utility\TestUtility { $this->assertEquals($return, $feed); } + + public function testUpdateUpdatesArticlesPerFeedCount() { + $feed = new Feed(); + $feed->setId(3); + $feed->getUrl('test'); + $feed->setUrlHash('yo'); + + $existingFeed = new Feed(); + $feed->setArticlesPerUpdate(2); + + $item = new Item(); + $item->setGuidHash(md5('hi')); + $item->setFeedId(3); + $items = array( + $item + ); + + $ex = new DoesNotExistException('hi'); + + $fetchReturn = array($feed, $items); + + $this->feedMapper->expects($this->any()) + ->method('find') + ->will($this->returnValue($existingFeed)); + + $this->fetcher->expects($this->once()) + ->method('fetch') + ->will($this->returnValue(array($feed, $items))); + + $this->feedMapper->expects($this->once()) + ->method('update') + ->with($this->equalTo($existingFeed)); + + + $this->feedBusinessLayer->update($feed->getId(), $this->user); + } + public function testUpdateFails(){ $feed = new Feed(); $feed->setId(3); @@ -336,6 +375,7 @@ class FeedBusinessLayerTest extends \OCA\AppFramework\Utility\TestUtility { $feed = new Feed(); $feed->setId(3); $feed->getUrl('test'); + $feed->setArticlesPerUpdate(1); $item = new Item(); $item->setGuidHash(md5('hi')); -- cgit v1.2.3