summaryrefslogtreecommitdiffstats
path: root/tests/unit/controller/ItemControllerTest.php
diff options
context:
space:
mode:
authorBernhard Posselt <Raydiation@users.noreply.github.com>2015-03-30 19:40:07 +0200
committerBernhard Posselt <Raydiation@users.noreply.github.com>2015-03-30 19:40:07 +0200
commit05985bc2965f8a332e98121050ba1f07343bbc0f (patch)
tree96ca5d59b7ce3c9d3678dd95d8595145d1d5df08 /tests/unit/controller/ItemControllerTest.php
parenteb7fc97f33cadcf041a06915b8f1650a9b4f6bbb (diff)
parentee3d2332ec97487893ae5f1f46b599c550b25eb6 (diff)
Merge pull request #751 from owncloud/next
Changes for 8.1
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()]];