summaryrefslogtreecommitdiffstats
path: root/tests/unit/service/ItemServiceTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/service/ItemServiceTest.php')
-rw-r--r--tests/unit/service/ItemServiceTest.php40
1 files changed, 35 insertions, 5 deletions
diff --git a/tests/unit/service/ItemServiceTest.php b/tests/unit/service/ItemServiceTest.php
index d7bf70dc9..0c062ff4c 100644
--- a/tests/unit/service/ItemServiceTest.php
+++ b/tests/unit/service/ItemServiceTest.php
@@ -30,7 +30,7 @@ class ItemServiceTest extends \PHPUnit_Framework_TestCase {
private $time;
private $newestItemId;
private $config;
-
+ private $systemConfig;
protected function setUp(){
$this->time = 222;
@@ -54,8 +54,13 @@ class ItemServiceTest extends \PHPUnit_Framework_TestCase {
'\OCA\News\Config\Config')
->disableOriginalConstructor()
->getMock();
+ $this->systemConfig = $this->getMockBuilder(
+ 'OCP\IConfig')
+ ->disableOriginalConstructor()
+ ->getMock();
$this->itemService = new ItemService($this->mapper,
- $this->statusFlag, $this->timeFactory, $this->config);
+ $this->statusFlag, $this->timeFactory, $this->config,
+ $this->systemConfig);
$this->user = 'jack';
$this->id = 3;
$this->updatedSince = 20333;
@@ -125,7 +130,8 @@ class ItemServiceTest extends \PHPUnit_Framework_TestCase {
$this->equalTo($this->offset),
$this->equalTo($this->status),
$this->equalTo(false),
- $this->equalTo($this->user))
+ $this->equalTo($this->user),
+ $this->equalTo([]))
->will($this->returnValue($this->response));
$result = $this->itemService->findAll(
@@ -145,7 +151,8 @@ class ItemServiceTest extends \PHPUnit_Framework_TestCase {
$this->equalTo($this->offset),
$this->equalTo($this->status),
$this->equalTo(true),
- $this->equalTo($this->user))
+ $this->equalTo($this->user),
+ $this->equalTo([]))
->will($this->returnValue($this->response));
$result = $this->itemService->findAll(
@@ -164,7 +171,8 @@ class ItemServiceTest extends \PHPUnit_Framework_TestCase {
$this->equalTo($this->offset),
$this->equalTo($this->status),
$this->equalTo(true),
- $this->equalTo($this->user))
+ $this->equalTo($this->user),
+ $this->equalTo([]))
->will($this->returnValue($this->response));
$result = $this->itemService->findAll(
@@ -175,6 +183,28 @@ class ItemServiceTest extends \PHPUnit_Framework_TestCase {
}
+ public function testFindAllSearch(){
+ $type = FeedType::STARRED;
+ $search = ['test'];
+ $this->mapper->expects($this->once())
+ ->method('findAll')
+ ->with( $this->equalTo($this->limit),
+ $this->equalTo($this->offset),
+ $this->equalTo($this->status),
+ $this->equalTo(true),
+ $this->equalTo($this->user),
+ $this->equalTo($search))
+ ->will($this->returnValue($this->response));
+
+ $result = $this->itemService->findAll(
+ $this->id, $type, $this->limit, $this->offset,
+ $this->showAll, true, $this->user, $search
+ );
+ $this->assertEquals($this->response, $result);
+ }
+
+
+
public function testStar(){
$itemId = 3;
$feedId = 5;