diff options
Diffstat (limited to 'tests/unit/service/ItemServiceTest.php')
-rw-r--r-- | tests/unit/service/ItemServiceTest.php | 30 |
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'); |