From f658beaf61962686738946211101321e2dcf860c Mon Sep 17 00:00:00 2001 From: Daniel Schaal Date: Fri, 18 Nov 2016 16:03:31 +0100 Subject: Throw ServiceNotFoundException when marking non-existent item as read (#61) * Throw ServiceNotFoundException when marking non-existent item as read Fixes #58 * Add test case for marking non-existent item as read --- tests/Unit/Service/ItemServiceTest.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests') diff --git a/tests/Unit/Service/ItemServiceTest.php b/tests/Unit/Service/ItemServiceTest.php index 107b6aef3..3b3197136 100644 --- a/tests/Unit/Service/ItemServiceTest.php +++ b/tests/Unit/Service/ItemServiceTest.php @@ -298,6 +298,18 @@ class ItemServiceTest extends \PHPUnit_Framework_TestCase { } + public function testReadDoesNotExist(){ + + $this->setExpectedException( + '\OCA\News\Service\ServiceNotFoundException' + ); + $this->mapper->expects($this->once()) + ->method('readItem') + ->will($this->throwException(new DoesNotExistException(''))); + + $this->itemService->read(1, true, $this->user); + } + public function testStarDoesNotExist(){ $this->setExpectedException( -- cgit v1.2.3