summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-04-18 12:09:26 -0700
committerBernhard Posselt <nukeawhale@gmail.com>2013-04-18 12:09:26 -0700
commitffea36001eddec3021b30217e8c17880c9b1eeb3 (patch)
treed9612377744f98ccfb7eb714727b2d9741316d45 /tests
parent2be96123d1831cdb8ec66f79aa1965f3ac86a804 (diff)
parent826e345c85b082e2d790f4a12d60f8fa1ff30a40 (diff)
Merge pull request #83 from owncloud/unkown-pubdate
Don't always mark feed items as unread if the pubDate of the item is unknown
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/businesslayer/FeedBusinessLayerTest.php46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/unit/businesslayer/FeedBusinessLayerTest.php b/tests/unit/businesslayer/FeedBusinessLayerTest.php
index b17a19136..0b147c837 100644
--- a/tests/unit/businesslayer/FeedBusinessLayerTest.php
+++ b/tests/unit/businesslayer/FeedBusinessLayerTest.php
@@ -292,6 +292,52 @@ class FeedBusinessLayerTest extends \OCA\AppFramework\Utility\TestUtility {
}
+ public function testUpdateUpdatesEntryNotWhenPubDateUnkown(){
+ $feed = new Feed();
+ $feed->setId(3);
+ $feed->getUrl('test');
+
+ $item = new Item();
+ $item->setGuidHash(md5('hi'));
+ $item->setPubDate(false);
+ $items = array(
+ $item
+ );
+
+ $item2 = new Item();
+ $item2->setPubDate(0);
+
+ $fetchReturn = array($feed, $items);
+
+ $this->mapper->expects($this->at(0))
+ ->method('find')
+ ->with($this->equalTo($feed->getId()),
+ $this->equalTo($this->user))
+ ->will($this->returnValue($feed));
+ $this->fetcher->expects($this->once())
+ ->method('fetch')
+ ->will($this->returnValue($fetchReturn));
+ $this->itemMapper->expects($this->once())
+ ->method('findByGuidHash')
+ ->with($this->equalTo($item->getGuidHash()),
+ $this->equalTo($feed->getId()),
+ $this->equalTo($this->user))
+ ->will($this->returnValue($item2));
+ $this->itemMapper->expects($this->never())
+ ->method('insert');
+ $this->itemMapper->expects($this->never())
+ ->method('delete');
+
+ $this->mapper->expects($this->at(1))
+ ->method('find')
+ ->with($feed->getId(), $this->user)
+ ->will($this->returnValue($feed));
+
+ $return = $this->businessLayer->update($feed->getId(), $this->user);
+
+ $this->assertEquals($return, $feed);
+ }
+
public function testUpdateUpdatesEntry(){
$feed = new Feed();