summaryrefslogtreecommitdiffstats
path: root/tests/bl/FolderBlTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/bl/FolderBlTest.php')
-rw-r--r--tests/bl/FolderBlTest.php36
1 files changed, 35 insertions, 1 deletions
diff --git a/tests/bl/FolderBlTest.php b/tests/bl/FolderBlTest.php
index 6b771e02b..c9fe50802 100644
--- a/tests/bl/FolderBlTest.php
+++ b/tests/bl/FolderBlTest.php
@@ -65,18 +65,35 @@ class FolderBlTest extends \OCA\AppFramework\Utility\TestUtility {
$folder = new Folder();
$folder->setName('hey');
$folder->setParentId(5);
+ $folder->setUserId('john');
$this->folderMapper->expects($this->once())
->method('insert')
->with($this->equalTo($folder))
->will($this->returnValue($folder));
- $result = $this->folderBl->create('hey', 5);
+ $result = $this->folderBl->create('hey', 'john', 5);
$this->assertEquals($folder, $result);
}
+ public function testCreateThrowsExWhenFolderNameExists(){
+ $folderName = 'hihi';
+ $rows = array(
+ array('id' => 1)
+ );
+
+ $this->folderMapper->expects($this->once())
+ ->method('findByName')
+ ->with($this->equalTo($folderName))
+ ->will($this->returnValue($rows));
+
+ $this->setExpectedException('\OCA\News\Bl\BLException');
+ $result = $this->folderBl->create($folderName, 'john', 3);
+ }
+
+
public function testOpen(){
$folder = new Folder();
@@ -114,4 +131,21 @@ class FolderBlTest extends \OCA\AppFramework\Utility\TestUtility {
$this->assertEquals('bogus', $folder->getName());
}
+
+ public function testRenameThrowsExWhenFolderNameExists(){
+ $folderName = 'hihi';
+ $rows = array(
+ array('id' => 1)
+ );
+
+ $this->folderMapper->expects($this->once())
+ ->method('findByName')
+ ->with($this->equalTo($folderName))
+ ->will($this->returnValue($rows));
+
+ $this->setExpectedException('\OCA\News\Bl\BLException');
+ $result = $this->folderBl->rename(3, $folderName, 'john');
+ }
+
+
}