diff options
author | Sean Molenaar <SMillerDev@users.noreply.github.com> | 2018-03-18 15:01:08 +0100 |
---|---|---|
committer | Bernhard Posselt <BernhardPosselt@users.noreply.github.com> | 2018-03-18 15:01:08 +0100 |
commit | 17e85dd5079b7ee0b1f18a450b66ec5df3cf5eb3 (patch) | |
tree | 4a4ddbea25429a4a9d82b8b28cd935d8838b30f3 /tests/Unit/Service/FolderServiceTest.php | |
parent | 2de169e43a17bdb6e1d19054e76de3ce7e220052 (diff) |
Unit: Fix unittests (#278)
* Unit: Fix unittests
Issue #171
* Tests: Move test namespace to the expected nextcloud namespace
Diffstat (limited to 'tests/Unit/Service/FolderServiceTest.php')
-rw-r--r-- | tests/Unit/Service/FolderServiceTest.php | 20 |
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()); |