diff options
author | Bernhard Posselt <Raydiation@users.noreply.github.com> | 2015-03-30 19:40:07 +0200 |
---|---|---|
committer | Bernhard Posselt <Raydiation@users.noreply.github.com> | 2015-03-30 19:40:07 +0200 |
commit | 05985bc2965f8a332e98121050ba1f07343bbc0f (patch) | |
tree | 96ca5d59b7ce3c9d3678dd95d8595145d1d5df08 /tests/unit/service | |
parent | eb7fc97f33cadcf041a06915b8f1650a9b4f6bbb (diff) | |
parent | ee3d2332ec97487893ae5f1f46b599c550b25eb6 (diff) |
Merge pull request #751 from owncloud/next
Changes for 8.1
Diffstat (limited to 'tests/unit/service')
-rw-r--r-- | tests/unit/service/FolderServiceTest.php | 2 | ||||
-rw-r--r-- | tests/unit/service/ItemServiceTest.php | 40 |
2 files changed, 36 insertions, 6 deletions
diff --git a/tests/unit/service/FolderServiceTest.php b/tests/unit/service/FolderServiceTest.php index c6e17bdbd..275bc8992 100644 --- a/tests/unit/service/FolderServiceTest.php +++ b/tests/unit/service/FolderServiceTest.php @@ -54,7 +54,7 @@ class FolderServiceTest extends \PHPUnit_Framework_TestCase { } - function testFindAll(){ + public function testFindAll(){ $userId = 'jack'; $return = 'hi'; $this->folderMapper->expects($this->once()) 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; |