diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-08-31 02:58:56 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-08-31 02:58:56 +0200 |
commit | 7036a1407c3dce54a6ac5e283ba55720f85ba7de (patch) | |
tree | 7c5fae7ab816a2b0c56b92ca74ebc7cc591d5a3d /tests/unit/businesslayer | |
parent | 6f23208ff68d4a8bf2fc20b1fcad6b5e636fb584 (diff) |
Throw proper error codes when creating invalid folders through the API, fix #297
Diffstat (limited to 'tests/unit/businesslayer')
-rw-r--r-- | tests/unit/businesslayer/FolderBusinessLayerTest.php | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/unit/businesslayer/FolderBusinessLayerTest.php b/tests/unit/businesslayer/FolderBusinessLayerTest.php index d28c078a5..7f512920e 100644 --- a/tests/unit/businesslayer/FolderBusinessLayerTest.php +++ b/tests/unit/businesslayer/FolderBusinessLayerTest.php @@ -115,6 +115,22 @@ class FolderBusinessLayerTest extends \OCA\AppFramework\Utility\TestUtility { } + public function testCreateThrowsExWhenFolderNameEmpty(){ + $folderName = ''; + $rows = array( + array('id' => 1) + ); + + $this->folderMapper->expects($this->once()) + ->method('findByName') + ->with($this->equalTo($folderName)) + ->will($this->returnValue(array())); + + $this->setExpectedException('\OCA\News\BusinessLayer\BusinessLayerValidationException'); + $result = $this->folderBusinessLayer->create($folderName, 'john', 3); + } + + public function testOpen(){ $folder = new Folder(); @@ -175,6 +191,22 @@ class FolderBusinessLayerTest extends \OCA\AppFramework\Utility\TestUtility { } + public function testRenameThrowsExWhenFolderNameEmpty(){ + $folderName = ''; + $rows = array( + array('id' => 1) + ); + + $this->folderMapper->expects($this->once()) + ->method('findByName') + ->with($this->equalTo($folderName)) + ->will($this->returnValue(array())); + + $this->setExpectedException('\OCA\News\BusinessLayer\BusinessLayerException'); + $result = $this->folderBusinessLayer->rename(3, $folderName, 'john'); + } + + public function testMarkDeleted() { $id = 3; $folder = new Folder(); |