diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-06-22 15:02:33 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-07-18 14:13:38 +0200 |
commit | 9807ee7d6b003b9dbef5eb4c78136f0e72d753ed (patch) | |
tree | e89178f33162edbf0a1bb2ef5e1c6f55057434b2 /tests/unit/utility | |
parent | 60f62a65069b63ed785756cb21a7a094cf5dd663 (diff) |
use current date when feed does not provide pubdates, disable article updates
Diffstat (limited to 'tests/unit/utility')
-rw-r--r-- | tests/unit/utility/FeedFetcherTest.php | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/tests/unit/utility/FeedFetcherTest.php b/tests/unit/utility/FeedFetcherTest.php index 94339fe96..1ea06e2ad 100644 --- a/tests/unit/utility/FeedFetcherTest.php +++ b/tests/unit/utility/FeedFetcherTest.php @@ -173,7 +173,7 @@ class FeedFetcherTest extends \OCA\AppFramework\Utility\TestUtility { } - private function createItem($author=false, $enclosureType=null) { + private function createItem($author=false, $enclosureType=null, $noPubDate=false) { $this->purifier->expects($this->once()) ->method('purify') ->with($this->equalTo($this->body)) @@ -182,9 +182,17 @@ class FeedFetcherTest extends \OCA\AppFramework\Utility\TestUtility { $this->expectItem('get_title', $this->title); $this->expectItem('get_id', $this->guid); $this->expectItem('get_content', $this->body); - $this->expectItem('get_date', $this->pub); $item = new Item(); + + if($noPubDate) { + $this->expectItem('get_date', 0); + $item->setPubDate($this->time); + } else { + $this->expectItem('get_date', $this->pub); + $item->setPubDate($this->pub); + } + $item->setStatus(0); $item->setUnread(); $item->setUrl($this->permalink); @@ -192,7 +200,6 @@ class FeedFetcherTest extends \OCA\AppFramework\Utility\TestUtility { $item->setGuid($this->guid); $item->setGuidHash(md5($this->guid)); $item->setBody($this->body2); - $item->setPubDate($this->pub); $item->setLastModified($this->time); if($author) { $mock = $this->getMock('author', array('get_name')); @@ -319,6 +326,20 @@ class FeedFetcherTest extends \OCA\AppFramework\Utility\TestUtility { $this->assertEquals(array($feed, array($item)), $result); } + + public function testFetchMapItemsNoPubdate(){ + $this->core->expects($this->once()) + ->method('init') + ->will($this->returnValue(true)); + $item = $this->createItem(false, true, true); + $feed = $this->createFeed(false, true); + $this->expectCore('get_items', array($this->item)); + $result = $this->fetcher->fetch($this->url); + + $this->assertEquals(array($feed, array($item)), $result); + } + + public function testFetchMapItemsGetFavicon() { $this->expectCore('get_title', $this->feedTitle); $this->expectCore('get_link', $this->feedLink); @@ -371,4 +392,5 @@ class FeedFetcherTest extends \OCA\AppFramework\Utility\TestUtility { $this->assertEquals(array($feed, array($item)), $result); } + } |