summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorlsmooth <ls@lsmooth.de>2013-06-09 01:08:12 +0200
committerlsmooth <ls@lsmooth.de>2013-06-09 01:08:12 +0200
commit24299e4db23c6dff15ca17152c0ef5cb8299a57d (patch)
treeb48de96cefb09a1832ba4a8bf0171468cc87c9c0 /tests
parentf8d3c8bf0e3c93ffba4a16cc8294f6a394915360 (diff)
don't update faviconLink on feed update
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/utility/FeedFetcherTest.php68
1 files changed, 60 insertions, 8 deletions
diff --git a/tests/unit/utility/FeedFetcherTest.php b/tests/unit/utility/FeedFetcherTest.php
index fdc817543..b783da296 100644
--- a/tests/unit/utility/FeedFetcherTest.php
+++ b/tests/unit/utility/FeedFetcherTest.php
@@ -91,13 +91,13 @@ class FeedFetcherTest extends \OCA\AppFramework\Utility\TestUtility {
->will($this->returnValue($this->time));
$this->cacheDuration = 100;
$this->cacheDirectory = 'dir/';
- $this->fetcher = new FeedFetcher($this->getAPIMock(),
- $this->coreFactory,
- $this->faviconFetcher,
- $timeFactory,
- $this->cacheDirectory,
- $this->cacheDuration,
- $this->purifier);
+ $this->fetcher = new FeedFetcher($this->getAPIMock(),
+ $this->coreFactory,
+ $this->faviconFetcher,
+ $timeFactory,
+ $this->cacheDirectory,
+ $this->cacheDuration,
+ $this->purifier);
$this->url = 'tests';
$this->permalink = 'http://permalink';
@@ -140,7 +140,7 @@ class FeedFetcherTest extends \OCA\AppFramework\Utility\TestUtility {
$this->setExpectedException('\OCA\News\Utility\FetcherException');
$this->fetcher->fetch($this->url);
}
-
+
public function testShouldCatchExceptionsAndThrowOwnException() {
$this->core->expects($this->once())
@@ -313,4 +313,56 @@ class FeedFetcherTest extends \OCA\AppFramework\Utility\TestUtility {
$this->assertEquals(array($feed, array($item)), $result);
}
+ public function testFetchMapItemsGetFavicon() {
+ $this->expectCore('get_title', $this->feedTitle);
+ $this->expectCore('get_link', $this->feedLink);
+
+ $feed = new Feed();
+ $feed->setTitle(html_entity_decode($this->feedTitle));
+ $feed->setUrl($this->url);
+ $feed->setLink($this->feedLink);
+ $feed->setUrlHash(md5($this->url));
+ $feed->setAdded($this->time);
+ $feed->setFaviconLink($this->webFavicon);
+
+ $this->core->expects($this->once())
+ ->method('init')
+ ->will($this->returnValue(true));
+
+ $this->faviconFetcher->expects($this->once())
+ ->method('fetch')
+ ->will($this->returnValue($this->webFavicon));
+
+ $item = $this->createItem(false, true);
+ $this->expectCore('get_items', array($this->item));
+ $result = $this->fetcher->fetch($this->url /*, true*/);
+
+ $this->assertEquals(array($feed, array($item)), $result);
+ }
+
+ public function testFetchMapItemsNoGetFavicon() {
+ $this->expectCore('get_title', $this->feedTitle);
+ $this->expectCore('get_link', $this->feedLink);
+
+ $feed = new Feed();
+ $feed->setTitle(html_entity_decode($this->feedTitle));
+ $feed->setUrl($this->url);
+ $feed->setLink($this->feedLink);
+ $feed->setUrlHash(md5($this->url));
+ $feed->setAdded($this->time);
+
+ $this->core->expects($this->once())
+ ->method('init')
+ ->will($this->returnValue(true));
+
+ $this->faviconFetcher->expects($this->never())
+ ->method('fetch');
+
+ $item = $this->createItem(false, true);
+ $this->expectCore('get_items', array($this->item));
+ $result = $this->fetcher->fetch($this->url, false);
+
+ $this->assertEquals(array($feed, array($item)), $result);
+ }
+
}