diff options
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/controller/ExportControllerTest.php | 11 | ||||
-rw-r--r-- | tests/unit/db/ItemTest.php | 17 | ||||
-rw-r--r-- | tests/unit/fetcher/FeedFetcherTest.php | 30 | ||||
-rw-r--r-- | tests/unit/service/FeedServiceTest.php | 2 |
4 files changed, 51 insertions, 9 deletions
diff --git a/tests/unit/controller/ExportControllerTest.php b/tests/unit/controller/ExportControllerTest.php index 635209041..6e7df683e 100644 --- a/tests/unit/controller/ExportControllerTest.php +++ b/tests/unit/controller/ExportControllerTest.php @@ -121,10 +121,11 @@ class ExportControllerTest extends \PHPUnit_Framework_TestCase { $this->assertEquals('[{"guid":null,"url":null,"title":null,' . '"author":null,"pubDate":null,"body":null,"enclosureMime":null,' . '"enclosureLink":null,"unread":false,"starred":false,' . - '"feedLink":"http:\/\/goo"},{"guid":null,"url":null,"title":null,' . - '"author":null,"pubDate":null,"body":null,"enclosureMime":null,' . - '"enclosureLink":null,"unread":false,"starred":false,' . - '"feedLink":"http:\/\/gee"}]', $return->render()); + '"feedLink":"http:\/\/goo","rtl":null},{"guid":null,"url":null,' . + '"title":null,"author":null,"pubDate":null,"body":null,' . + '"enclosureMime":null,"enclosureLink":null,"unread":false,' . + '"starred":false,"feedLink":"http:\/\/gee","rtl":null}]', + $return->render()); } -}
\ No newline at end of file +} diff --git a/tests/unit/db/ItemTest.php b/tests/unit/db/ItemTest.php index ec92eb4d9..2b2502d3a 100644 --- a/tests/unit/db/ItemTest.php +++ b/tests/unit/db/ItemTest.php @@ -64,6 +64,7 @@ class ItemTest extends \PHPUnit_Framework_TestCase { $item->setBody('body'); $item->setEnclosureMime('audio/ogg'); $item->setEnclosureLink('enclink'); + $item->setRtl(true); $item->setFeedId(1); $item->setStatus(0); $item->setUnread(); @@ -84,7 +85,8 @@ class ItemTest extends \PHPUnit_Framework_TestCase { 'feedId' => 1, 'unread' => true, 'starred' => true, - 'lastModified' => 321 + 'lastModified' => 321, + 'rtl' => true ], $item->toAPI()); } @@ -103,6 +105,7 @@ class ItemTest extends \PHPUnit_Framework_TestCase { $item->setEnclosureLink('enclink'); $item->setFeedId(1); $item->setStatus(0); + $item->setRtl(true); $item->setUnread(); $item->setStarred(); $item->setLastModified(321); @@ -121,7 +124,8 @@ class ItemTest extends \PHPUnit_Framework_TestCase { 'feedId' => 1, 'unread' => true, 'starred' => true, - 'lastModified' => 321 + 'lastModified' => 321, + 'rtl' => true ], $item->jsonSerialize()); } @@ -138,6 +142,7 @@ class ItemTest extends \PHPUnit_Framework_TestCase { $item->setEnclosureMime('audio/ogg'); $item->setEnclosureLink('enclink'); $item->setFeedId(1); + $item->setRtl(true); $item->setStatus(0); $item->setRead(); $item->setStarred(); @@ -158,7 +163,8 @@ class ItemTest extends \PHPUnit_Framework_TestCase { 'enclosureLink' => 'enclink', 'unread' => false, 'starred' => true, - 'feedLink' => 'http://test' + 'feedLink' => 'http://test', + 'rtl' => true ], $item->toExport($feeds)); } @@ -175,6 +181,7 @@ class ItemTest extends \PHPUnit_Framework_TestCase { $item->setEnclosureMime('audio/ogg'); $item->setEnclosureLink('enclink'); $item->setStarred(); + $item->setRtl(true); if ($isRead) { $item->setUnread(); @@ -212,6 +219,7 @@ class ItemTest extends \PHPUnit_Framework_TestCase { 'enclosureLink' => $item->getEnclosureLink(), 'unread' => $item->isUnread(), 'starred' => $item->isStarred(), + 'rtl' => $item->getRtl() ]; $compareWith = Item::fromImport($import); @@ -234,6 +242,7 @@ class ItemTest extends \PHPUnit_Framework_TestCase { 'enclosureLink' => $item->getEnclosureLink(), 'unread' => $item->isUnread(), 'starred' => $item->isStarred(), + 'rtl' => $item->getRtl() ]; $compareWith = Item::fromImport($import); @@ -281,4 +290,4 @@ class ItemTest extends \PHPUnit_Framework_TestCase { } -}
\ No newline at end of file +} diff --git a/tests/unit/fetcher/FeedFetcherTest.php b/tests/unit/fetcher/FeedFetcherTest.php index 2c743500a..0cb0650ba 100644 --- a/tests/unit/fetcher/FeedFetcherTest.php +++ b/tests/unit/fetcher/FeedFetcherTest.php @@ -41,6 +41,8 @@ class FeedFetcherTest extends \PHPUnit_Framework_TestCase { private $body; private $author; private $enclosureLink; + private $rtl; + private $language; // feed private $feedTitle; @@ -50,6 +52,7 @@ class FeedFetcherTest extends \PHPUnit_Framework_TestCase { private $modified; private $etag; private $location; + private $feedLanguage; protected function setUp(){ $this->l10n = $this->getMockBuilder( @@ -119,6 +122,8 @@ class FeedFetcherTest extends \PHPUnit_Framework_TestCase { $this->etag = 'yo'; $this->content = 'some content'; $this->encoding = 'UTF-8'; + $this->language = 'de-DE'; + $this->feedLanguage = 'de-DE'; } @@ -218,6 +223,7 @@ class FeedFetcherTest extends \PHPUnit_Framework_TestCase { $item->setBody($this->body); $item->setLastModified($this->time); $item->generateSearchIndex(); + $item->setRtl(false); $this->expectItem('getAuthor', $this->author); $item->setAuthor(html_entity_decode($this->author)); @@ -347,4 +353,28 @@ class FeedFetcherTest extends \PHPUnit_Framework_TestCase { } + public function testRtl() { + $this->setUpReader($this->url); + $this->expectFeed('getLanguage', 'he-IL'); + $feed = $this->createFeed(); + $item = $this->createItem(null); + $this->expectFeed('getItems', [$this->item]); + list($feed, $items) = $this->fetcher->fetch($this->url, false, null, + null, true); + $this->assertTrue($items[0]->getRtl()); + } + + + public function testRtlItem() { + $this->setUpReader($this->url); + $this->expectFeed('getLanguage', 'de-DE', 0); + $this->expectItem('getLanguage', 'he-IL'); + + $feed = $this->createFeed(); + $item = $this->createItem(null); + $this->expectFeed('getItems', [$this->item]); + list($feed, $items) = $this->fetcher->fetch($this->url, false, null, + null, true); + $this->assertTrue($items[0]->getRtl()); + } } diff --git a/tests/unit/service/FeedServiceTest.php b/tests/unit/service/FeedServiceTest.php index ae85ed5a7..697a95efe 100644 --- a/tests/unit/service/FeedServiceTest.php +++ b/tests/unit/service/FeedServiceTest.php @@ -630,6 +630,7 @@ class FeedServiceTest extends \PHPUnit_Framework_TestCase { $item->setUnread(); $item->setUnstarred(); $item->setLastModified($this->time); + $item->generateSearchIndex(); $json = $item->toExport(['feed3' => $feed]); @@ -686,6 +687,7 @@ class FeedServiceTest extends \PHPUnit_Framework_TestCase { $item->setUnread(); $item->setUnstarred(); $item->setLastModified($this->time); + $item->generateSearchIndex(); $json = $item->toExport(['feed3' => $feed]); $json2 = $json; |