diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-09-13 17:59:16 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-09-13 17:59:16 +0200 |
commit | dda579ccaac67b5f360af98926a1697389bdbc6c (patch) | |
tree | 63e9dc2af7218515323dee9e56d381decd811eef /tests/unit/businesslayer | |
parent | 7f3a42d9493c0c9e23ad6084a77bcd164b588ad2 (diff) |
also store feeds per article when doing updates
Diffstat (limited to 'tests/unit/businesslayer')
-rw-r--r-- | tests/unit/businesslayer/FeedBusinessLayerTest.php | 40 |
1 files changed, 40 insertions, 0 deletions
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')); |