diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-20 23:00:39 +0100 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-20 23:00:39 +0100 |
commit | a1fb325f85af12e2eea90edb70fedcaf8d9d62ca (patch) | |
tree | d88ebe96b8cd1e798d567bf5a3e5b0a541cbed30 | |
parent | 131581e6ea881e096a1f6d022a8ed826c76df70a (diff) |
finished folder businesslayer
-rw-r--r-- | bl/folderbl.php | 22 | ||||
-rw-r--r-- | tests/bl/FeedBlTest.php | 23 |
2 files changed, 28 insertions, 17 deletions
diff --git a/bl/folderbl.php b/bl/folderbl.php index 9f9c09d15..fa12380e3 100644 --- a/bl/folderbl.php +++ b/bl/folderbl.php @@ -35,7 +35,7 @@ class FolderBl extends Bl { } - public function getAll($userId) { + public function findAll($userId) { return $this->mapper->findAllFromUser($userId); } @@ -55,19 +55,11 @@ class FolderBl extends Bl { } -/* - public function modify($folderid, $name = null, $parent = null, $opened = null) { - $folder = $this->folderMapper->find($folderid); - if(!$folder) - return false; - - if($name) - $folder->setName($name); - if($parent) - $folder->setParentId($parent); - if($opened) - $folder->setOpened($opened); - return $this->folderMapper->update($folder); + public function rename($folderId, $folderName, $userId){ + $folder = $this->find($folderId, $userId); + $folder->setName($folderName); + $this->mapper->update($folder); } -*/ + + } diff --git a/tests/bl/FeedBlTest.php b/tests/bl/FeedBlTest.php index 01301b91f..dca99c682 100644 --- a/tests/bl/FeedBlTest.php +++ b/tests/bl/FeedBlTest.php @@ -47,7 +47,7 @@ class FolderBlTest extends \OCA\AppFramework\Utility\TestUtility { } - function testGetAll(){ + function testFindAll(){ $userId = 'jack'; $return = 'hi'; $this->folderMapper->expects($this->once()) @@ -55,7 +55,7 @@ class FolderBlTest extends \OCA\AppFramework\Utility\TestUtility { ->with($this->equalTo($userId)) ->will($this->returnValue($return)); - $result = $this->folderBl->getAll($userId); + $result = $this->folderBl->findAll($userId); $this->assertEquals($return, $result); } @@ -95,4 +95,23 @@ class FolderBlTest extends \OCA\AppFramework\Utility\TestUtility { } + + public function testRename(){ + $folder = new Folder(); + $folder->setName('jooohn'); + + $this->folderMapper->expects($this->once()) + ->method('find') + ->with($this->equalTo(3)) + ->will($this->returnValue($folder)); + + $this->folderMapper->expects($this->once()) + ->method('update') + ->with($this->equalTo($folder)); + + $this->folderBl->rename(3, 'bogus', ''); + + $this->assertEquals('bogus', $folder->getName()); + } + } |