summaryrefslogtreecommitdiffstats
path: root/tests/unit/businesslayer/FolderBusinessLayerTest.php
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-08-31 02:58:56 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2013-08-31 02:58:56 +0200
commit7036a1407c3dce54a6ac5e283ba55720f85ba7de (patch)
tree7c5fae7ab816a2b0c56b92ca74ebc7cc591d5a3d /tests/unit/businesslayer/FolderBusinessLayerTest.php
parent6f23208ff68d4a8bf2fc20b1fcad6b5e636fb584 (diff)
Throw proper error codes when creating invalid folders through the API, fix #297
Diffstat (limited to 'tests/unit/businesslayer/FolderBusinessLayerTest.php')
-rw-r--r--tests/unit/businesslayer/FolderBusinessLayerTest.php32
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();