diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-05-14 18:08:52 +0200 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-05-14 18:08:52 +0200 |
commit | d9acb9ed876d9814e468081d799f06ffd631580f (patch) | |
tree | 887653ca34a9b67adeb60435b3dd37f7329619c3 /tests/unit/controller | |
parent | f52cdaa750f1efa8cb76f6d88c9b1dc291f7b328 (diff) |
add serverside possibility to order by oldest first
Diffstat (limited to 'tests/unit/controller')
-rw-r--r-- | tests/unit/controller/ItemControllerTest.php | 22 | ||||
-rw-r--r-- | tests/unit/controller/PageControllerTest.php | 32 |
2 files changed, 44 insertions, 10 deletions
diff --git a/tests/unit/controller/ItemControllerTest.php b/tests/unit/controller/ItemControllerTest.php index b4f87a0e9..1ebcdce55 100644 --- a/tests/unit/controller/ItemControllerTest.php +++ b/tests/unit/controller/ItemControllerTest.php @@ -188,20 +188,26 @@ class ItemControllerTest extends \PHPUnit_Framework_TestCase { } - private function itemsApiExpects($id, $type){ - $this->settings->expects($this->once()) + private function itemsApiExpects($id, $type, $oldestFirst='1'){ + $this->settings->expects($this->at(0)) ->method('getUserValue') ->with($this->equalTo($this->user), $this->equalTo($this->appName), $this->equalTo('showAll')) ->will($this->returnValue('1')); $this->settings->expects($this->at(1)) + ->method('getUserValue') + ->with($this->equalTo($this->user), + $this->equalTo($this->appName), + $this->equalTo('oldestFirst')) + ->will($this->returnValue($oldestFirst)); + $this->settings->expects($this->at(2)) ->method('setUserValue') ->with($this->equalTo($this->user), $this->equalTo($this->appName), $this->equalTo('lastViewedFeedId'), $this->equalTo($id)); - $this->settings->expects($this->at(2)) + $this->settings->expects($this->at(3)) ->method('setUserValue') ->with($this->equalTo($this->user), $this->equalTo($this->appName), @@ -219,7 +225,7 @@ class ItemControllerTest extends \PHPUnit_Framework_TestCase { 'starred' => 3111 ]; - $this->itemsApiExpects(2, FeedType::FEED); + $this->itemsApiExpects(2, FeedType::FEED, '0'); $this->feedBusinessLayer->expects($this->once()) ->method('findAll') @@ -244,7 +250,8 @@ class ItemControllerTest extends \PHPUnit_Framework_TestCase { $this->equalTo(3), $this->equalTo(0), $this->equalTo(true), - $this->equalTo($this->user)) + $this->equalTo($this->user), + $this->equalTo(false)) ->will($this->returnValue($result['items'])); $response = $this->controller->index(FeedType::FEED, 2, 3); @@ -264,13 +271,14 @@ class ItemControllerTest extends \PHPUnit_Framework_TestCase { $this->equalTo(3), $this->equalTo(10), $this->equalTo(true), - $this->equalTo($this->user)) + $this->equalTo($this->user), + $this->equalTo(true)) ->will($this->returnValue($result['items'])); $this->feedBusinessLayer->expects($this->never()) ->method('findAll'); - $response = $this->controller->index(FeedType::FEED, 2, 3, 10); + $response = $this->controller->index(FeedType::FEED, 2, 3, 10, true); $this->assertEquals($result, $response); } diff --git a/tests/unit/controller/PageControllerTest.php b/tests/unit/controller/PageControllerTest.php index d4c53e468..1e898c146 100644 --- a/tests/unit/controller/PageControllerTest.php +++ b/tests/unit/controller/PageControllerTest.php @@ -60,7 +60,9 @@ class PageControllerTest extends \PHPUnit_Framework_TestCase { $result = [ 'showAll' => true, 'compact' => true, - 'language' => 'de' + 'readOnScroll' => true, + 'oldestFirst' => true, + 'language' => 'de', ]; $this->l10n->expects($this->once()) @@ -78,6 +80,18 @@ class PageControllerTest extends \PHPUnit_Framework_TestCase { $this->equalTo($this->appName), $this->equalTo('compact')) ->will($this->returnValue('1')); + $this->settings->expects($this->at(2)) + ->method('getUserValue') + ->with($this->equalTo($this->user), + $this->equalTo($this->appName), + $this->equalTo('readOnScroll')) + ->will($this->returnValue('1')); + $this->settings->expects($this->at(3)) + ->method('getUserValue') + ->with($this->equalTo($this->user), + $this->equalTo($this->appName), + $this->equalTo('oldestFirst')) + ->will($this->returnValue('1')); $response = $this->controller->settings(); $this->assertEquals($result, $response); @@ -97,7 +111,19 @@ class PageControllerTest extends \PHPUnit_Framework_TestCase { $this->equalTo($this->appName), $this->equalTo('compact'), $this->equalTo(true)); - $this->controller->updateSettings(true, true); + $this->settings->expects($this->at(2)) + ->method('setUserValue') + ->with($this->equalTo($this->user), + $this->equalTo($this->appName), + $this->equalTo('readOnScroll'), + $this->equalTo(true)); + $this->settings->expects($this->at(3)) + ->method('setUserValue') + ->with($this->equalTo($this->user), + $this->equalTo($this->appName), + $this->equalTo('oldestFirst'), + $this->equalTo(true)); + $this->controller->updateSettings(true, true, true, true); } @@ -113,7 +139,7 @@ class PageControllerTest extends \PHPUnit_Framework_TestCase { $this->equalTo('showAll'), $this->equalTo(true)); - $this->controller->updateSettings(true, null); + $this->controller->updateSettings(true, null, null, null); } }
\ No newline at end of file |