diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-05-02 19:40:10 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-05-02 19:40:10 +0200 |
commit | 5ae697ac9dbaf999d51fa7805078249f33c301dc (patch) | |
tree | a4f408c9462ff4353820e266efad4864043d08f2 /tests/unit/controller/FeedControllerTest.php | |
parent | e9878cb5b583bc993a9f3a482d0b371bbeea5bd2 (diff) |
added proper exception handling for all controllers and businesslayer
Diffstat (limited to 'tests/unit/controller/FeedControllerTest.php')
-rw-r--r-- | tests/unit/controller/FeedControllerTest.php | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/unit/controller/FeedControllerTest.php b/tests/unit/controller/FeedControllerTest.php index 14c31b545..403d9c3c8 100644 --- a/tests/unit/controller/FeedControllerTest.php +++ b/tests/unit/controller/FeedControllerTest.php @@ -348,6 +348,29 @@ class FeedControllerTest extends ControllerTestUtility { } + public function testDeleteDoesNotExist(){ + $url = array( + 'feedId' => 4 + ); + $msg = 'hehe'; + $this->controller = $this->getPostController(array(), $url); + + $this->api->expects($this->once()) + ->method('getUserId') + ->will($this->returnValue($this->user)); + $this->feedBusinessLayer->expects($this->once()) + ->method('delete') + ->will($this->throwException(new BusinessLayerException($msg))); + + $response = $this->controller->delete(); + $params = json_decode($response->render(), true); + + $this->assertEquals('error', $params['status']); + $this->assertEquals($msg, $params['msg']); + $this->assertTrue($response instanceof JSONResponse); + } + + public function testUpdate(){ $feed = new Feed(); $feed->setId(3); @@ -433,6 +456,32 @@ class FeedControllerTest extends ControllerTestUtility { } + public function testMoveDoesNotExist(){ + $post = array( + 'parentFolderId' => 3 + ); + $url = array( + 'feedId' => 4 + ); + $msg = 'john'; + $this->controller = $this->getPostController($post, $url); + + $this->api->expects($this->once()) + ->method('getUserId') + ->will($this->returnValue($this->user)); + $this->feedBusinessLayer->expects($this->once()) + ->method('move') + ->will($this->throwException(new BusinessLayerException($msg))); + + $response = $this->controller->move(); + $params = json_decode($response->render(), true); + + $this->assertEquals('error', $params['status']); + $this->assertEquals($msg, $params['msg']); + $this->assertTrue($response instanceof JSONResponse); + } + + public function testImportGoogleReader() { $feed = new Feed(); |