summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-10-09 10:02:44 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-10-09 10:02:44 +0200
commitde2121d066e85aad0c67c498bcf2fd242824f83b (patch)
treecae3b1f72f68142b4ca1b3a4a6eadc9a35274557
parent462e62598d9c9ce8bb1732ffefdc52caa4abc2b3 (diff)
More coverage
-rw-r--r--tests/unit/controller/FeedApiControllerTest.php21
-rw-r--r--tests/unit/controller/ItemControllerTest.php16
2 files changed, 37 insertions, 0 deletions
diff --git a/tests/unit/controller/FeedApiControllerTest.php b/tests/unit/controller/FeedApiControllerTest.php
index c614dac82..8dff56f2e 100644
--- a/tests/unit/controller/FeedApiControllerTest.php
+++ b/tests/unit/controller/FeedApiControllerTest.php
@@ -278,6 +278,27 @@ class FeedApiControllerTest extends \PHPUnit_Framework_TestCase {
}
+ public function testRenameError() {
+ $feedId = 3;
+ $feedTitle = 'test';
+
+ $this->feedService->expects($this->once())
+ ->method('rename')
+ ->with(
+ $this->equalTo($feedId),
+ $this->equalTo($feedTitle),
+ $this->equalTo($this->user))
+ ->will($this->throwException(new ServiceNotFoundException('hi')));
+
+ $result = $this->feedAPI->rename($feedId, $feedTitle);
+ $data = $result->getData();
+ $code = $result->getStatus();
+
+ $this->assertSame(Http::STATUS_NOT_FOUND, $code);
+ $this->assertSame('hi', $data['message']);
+ }
+
+
public function testfromAllUsers(){
$feed = new Feed();
$feed->setUrl(3);
diff --git a/tests/unit/controller/ItemControllerTest.php b/tests/unit/controller/ItemControllerTest.php
index b5a579783..b366fdfa0 100644
--- a/tests/unit/controller/ItemControllerTest.php
+++ b/tests/unit/controller/ItemControllerTest.php
@@ -100,6 +100,22 @@ class ItemControllerTest extends \PHPUnit_Framework_TestCase {
}
+ public function testReadMultipleDontStopOnException() {
+ $this->itemService->expects($this->at(0))
+ ->method('read')
+ ->with($this->equalTo(2),
+ $this->equalTo(true),
+ $this->equalTo($this->user))
+ ->will($this->throwException(new ServiceNotFoundException('yo')));
+ $this->itemService->expects($this->at(1))
+ ->method('read')
+ ->with($this->equalTo(4),
+ $this->equalTo(true),
+ $this->equalTo($this->user));
+ $this->controller->readMultiple([2, 4]);
+ }
+
+
public function testStar(){
$this->itemService->expects($this->once())
->method('star')