summaryrefslogtreecommitdiffstats
path: root/tests/Unit/Service/FolderServiceTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Unit/Service/FolderServiceTest.php')
-rw-r--r--tests/Unit/Service/FolderServiceTest.php20
1 files changed, 15 insertions, 5 deletions
diff --git a/tests/Unit/Service/FolderServiceTest.php b/tests/Unit/Service/FolderServiceTest.php
index 65563b644..68dcda3f1 100644
--- a/tests/Unit/Service/FolderServiceTest.php
+++ b/tests/Unit/Service/FolderServiceTest.php
@@ -11,9 +11,10 @@
* @copyright Bernhard Posselt 2012, 2014
*/
-namespace OCA\News\Service;
+namespace OCA\News\Tests\Unit\Service;
use \OCA\News\Db\Folder;
+use OCA\News\Service\FolderService;
class FolderServiceTest extends \PHPUnit_Framework_TestCase {
@@ -80,6 +81,11 @@ class FolderServiceTest extends \PHPUnit_Framework_TestCase {
->with($this->equalTo($folder))
->will($this->returnValue($folder));
+ $this->folderMapper->expects($this->once())
+ ->method('findByName')
+ ->with('hey', 'john')
+ ->will($this->returnValue([]));
+
$result = $this->folderService->create('hey', 'john', 5);
$this->assertEquals($folder, $result);
@@ -103,7 +109,9 @@ class FolderServiceTest extends \PHPUnit_Framework_TestCase {
$this->folderService->create($folderName, 'john', 3);
}
-
+ /**
+ * @expectedException \OCA\News\Service\ServiceValidationException
+ */
public function testCreateThrowsExWhenFolderNameEmpty(){
$folderName = '';
@@ -112,9 +120,6 @@ class FolderServiceTest extends \PHPUnit_Framework_TestCase {
->with($this->equalTo($folderName))
->will($this->returnValue([]));
- $this->setExpectedException(
- '\OCA\News\Service\ServiceValidationException'
- );
$this->folderService->create($folderName, 'john', 3);
}
@@ -151,6 +156,11 @@ class FolderServiceTest extends \PHPUnit_Framework_TestCase {
->method('update')
->with($this->equalTo($folder));
+ $this->folderMapper->expects($this->once())
+ ->method('findByName')
+ ->with('bogus', '')
+ ->will($this->returnValue([]));
+
$this->folderService->rename(3, 'bogus', '');
$this->assertEquals('bogus', $folder->getName());