summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-03-20 23:00:39 +0100
committerBernhard Posselt <nukeawhale@gmail.com>2013-03-21 00:31:41 +0100
commitef2af010a63bfcf511cdf648e9358a3956d97739 (patch)
treed88ebe96b8cd1e798d567bf5a3e5b0a541cbed30
parent6dab27a668b33f91efe5905d0bcb83d4b212ee86 (diff)
finished folder businesslayer
-rw-r--r--bl/folderbl.php22
-rw-r--r--tests/bl/FeedBlTest.php23
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());
+ }
+
}