summaryrefslogtreecommitdiffstats
path: root/tests/unit/controller/ItemControllerTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/controller/ItemControllerTest.php')
-rw-r--r--tests/unit/controller/ItemControllerTest.php48
1 files changed, 47 insertions, 1 deletions
diff --git a/tests/unit/controller/ItemControllerTest.php b/tests/unit/controller/ItemControllerTest.php
index 88e49c690..72c6d38f0 100644
--- a/tests/unit/controller/ItemControllerTest.php
+++ b/tests/unit/controller/ItemControllerTest.php
@@ -226,7 +226,8 @@ class ItemControllerTest extends \PHPUnit_Framework_TestCase {
$this->equalTo(0),
$this->equalTo(true),
$this->equalTo(false),
- $this->equalTo($this->user))
+ $this->equalTo($this->user),
+ $this->equalTo([]))
->will($this->returnValue($result['items']));
$response = $this->controller->index(FeedType::FEED, 2, 3);
@@ -234,6 +235,51 @@ class ItemControllerTest extends \PHPUnit_Framework_TestCase {
}
+ public function testIndexSearch(){
+ $feeds = [new Feed()];
+ $result = [
+ 'items' => [new Item()],
+ 'feeds' => $feeds,
+ 'newestItemId' => $this->newestItemId,
+ 'starred' => 3111
+ ];
+
+ $this->itemsApiExpects(2, FeedType::FEED, '0');
+
+ $this->feedService->expects($this->once())
+ ->method('findAll')
+ ->with($this->equalTo($this->user))
+ ->will($this->returnValue($feeds));
+
+ $this->itemService->expects($this->once())
+ ->method('getNewestItemId')
+ ->with($this->equalTo($this->user))
+ ->will($this->returnValue($this->newestItemId));
+
+ $this->itemService->expects($this->once())
+ ->method('starredCount')
+ ->with($this->equalTo($this->user))
+ ->will($this->returnValue(3111));
+
+ $this->itemService->expects($this->once())
+ ->method('findAll')
+ ->with(
+ $this->equalTo(2),
+ $this->equalTo(FeedType::FEED),
+ $this->equalTo(3),
+ $this->equalTo(0),
+ $this->equalTo(true),
+ $this->equalTo(false),
+ $this->equalTo($this->user),
+ $this->equalTo(['test', 'search']))
+ ->will($this->returnValue($result['items']));
+
+ $response = $this->controller->index(FeedType::FEED, 2, 3,
+ 0, null, null, 'test%20%20search%20');
+ $this->assertEquals($result, $response);
+ }
+
+
public function testItemsOffsetNotZero(){
$result = ['items' => [new Item()]];