summaryrefslogtreecommitdiffstats
path: root/tests/unit/controller/ItemControllerTest.php
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-05-14 18:08:52 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-05-14 18:08:52 +0200
commitd9acb9ed876d9814e468081d799f06ffd631580f (patch)
tree887653ca34a9b67adeb60435b3dd37f7329619c3 /tests/unit/controller/ItemControllerTest.php
parentf52cdaa750f1efa8cb76f6d88c9b1dc291f7b328 (diff)
add serverside possibility to order by oldest first
Diffstat (limited to 'tests/unit/controller/ItemControllerTest.php')
-rw-r--r--tests/unit/controller/ItemControllerTest.php22
1 files changed, 15 insertions, 7 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);
}