summaryrefslogtreecommitdiffstats
path: root/tests/unit/service
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-10-09 09:52:12 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-10-09 09:52:12 +0200
commit13b13aeda19310e97d8e8a91d4adb6ad358a93c8 (patch)
treec7105ea5e5aca461b6db26aa7b9814b281bfed95 /tests/unit/service
parentb32fc30d68e18994d2b17bbb30eac0b33ec6af3c (diff)
more code coverage
Diffstat (limited to 'tests/unit/service')
-rw-r--r--tests/unit/service/ItemServiceTest.php30
1 files changed, 29 insertions, 1 deletions
diff --git a/tests/unit/service/ItemServiceTest.php b/tests/unit/service/ItemServiceTest.php
index d5947b406..2f5f31cba 100644
--- a/tests/unit/service/ItemServiceTest.php
+++ b/tests/unit/service/ItemServiceTest.php
@@ -243,7 +243,7 @@ class ItemServiceTest extends \PHPUnit_Framework_TestCase {
$this->assertTrue($item->isUnstarred());
}
- public function testRead(){
+ public function testUnread(){
$itemId = 3;
$item = new Item();
$item->setStatus(128);
@@ -271,6 +271,34 @@ class ItemServiceTest extends \PHPUnit_Framework_TestCase {
}
+ public function testRead(){
+ $itemId = 3;
+ $item = new Item();
+ $item->setStatus(128);
+ $item->setId($itemId);
+ $item->setUnread();
+
+ $expectedItem = new Item();
+ $expectedItem->setStatus(128);
+ $expectedItem->setRead();
+ $expectedItem->setId($itemId);
+ $expectedItem->setLastModified($this->time);
+
+ $this->mapper->expects($this->once())
+ ->method('find')
+ ->with($this->equalTo($itemId), $this->equalTo($this->user))
+ ->will($this->returnValue($item));
+
+ $this->mapper->expects($this->once())
+ ->method('update')
+ ->with($this->equalTo($expectedItem));
+
+ $this->itemService->read($itemId, true, $this->user);
+
+ $this->assertTrue($item->isRead());
+ }
+
+
public function testStarDoesNotExist(){
$this->setExpectedException('\OCA\News\Service\ServiceNotFoundException');