diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-02-10 11:15:57 +0100 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-02-10 11:16:17 +0100 |
commit | 2d293fea4328123f9d20a73f8d1bac79e746c9bd (patch) | |
tree | ad39f8e42e0dbed63d5b532f527c2912ca3f3160 /tests/controller | |
parent | 285ec73695ad938272a7232b3648bae7a944d3d0 (diff) |
added another exception for collapsing folders
Diffstat (limited to 'tests/controller')
-rw-r--r-- | tests/controller/FolderControllerTest.php | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/tests/controller/FolderControllerTest.php b/tests/controller/FolderControllerTest.php index ac7ca30f0..1381f8916 100644 --- a/tests/controller/FolderControllerTest.php +++ b/tests/controller/FolderControllerTest.php @@ -27,8 +27,9 @@ namespace OCA\News\Controller; use \OCA\AppFramework\Http\Request; use \OCA\AppFramework\Http\JSONResponse; -use OCA\AppFramework\Utility\ControllerTestUtility; +use \OCA\AppFramework\Utility\ControllerTestUtility; use \OCA\AppFramework\Db\DoesNotExistException; +use \OCA\AppFramework\Db\MultipleObjectsReturnedException; require_once(__DIR__ . "/../classloader.php"); @@ -147,9 +148,7 @@ class FolderControllerTest extends ControllerTestUtility { } - public function testCollapseExceptionReturnsJSONError(){ - $errorMsg = 'exception'; - $ex = new DoesNotExistException($errorMsg); + private function collapseException($ex){ $urlParams = array('folderId' => 1); $this->folderMapper->expects($this->once()) ->method('setCollapsed') @@ -159,9 +158,21 @@ class FolderControllerTest extends ControllerTestUtility { $response = $this->controller->collapse(); - $expected = '{"status":"error","data":[],"msg":"' . $errorMsg . '"}'; + $expected = '{"status":"error","data":[],"msg":"' . $ex->getMessage() . '"}'; $this->assertEquals($expected, $response->render()); } + public function testCollapseDoesNotExistExceptionReturnsJSONError(){ + $ex = new DoesNotExistException('exception'); + $this->collapseException($ex); + } + + + public function testCollapseMultipleObjectsReturnedReturnsJSONError(){ + $ex = new MultipleObjectsReturnedException('exception'); + $this->collapseException($ex); + } + + }
\ No newline at end of file |