diff options
author | Sean Molenaar <sean@seanmolenaar.eu> | 2020-11-03 21:56:37 +0100 |
---|---|---|
committer | Sean Molenaar <SMillerDev@users.noreply.github.com> | 2020-11-03 23:12:01 +0100 |
commit | af2fd96825d6ae2c7802e9f3bac9054e85093396 (patch) | |
tree | e95ec3d0524f0153c0510f77aeee34f77c83e95f /tests/Unit/Controller/FolderApiControllerTest.php | |
parent | ab149a7870281d4ed02806575734424849db755c (diff) |
Controllers: Use v2 services
Signed-off-by: Sean Molenaar <sean@seanmolenaar.eu>
Diffstat (limited to 'tests/Unit/Controller/FolderApiControllerTest.php')
-rw-r--r-- | tests/Unit/Controller/FolderApiControllerTest.php | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/tests/Unit/Controller/FolderApiControllerTest.php b/tests/Unit/Controller/FolderApiControllerTest.php index 3c5650e5c..fdf494037 100644 --- a/tests/Unit/Controller/FolderApiControllerTest.php +++ b/tests/Unit/Controller/FolderApiControllerTest.php @@ -17,6 +17,7 @@ namespace OCA\News\Tests\Unit\Controller; use OCA\News\Controller\FolderApiController; use OCA\News\Service\FolderService; +use OCA\News\Service\FolderServiceV2; use OCA\News\Service\ItemService; use \OCP\AppFramework\Http; @@ -59,7 +60,7 @@ class FolderApiControllerTest extends TestCase $this->user->expects($this->any()) ->method('getUID') ->will($this->returnValue('123')); - $this->folderService = $this->getMockBuilder(FolderService::class) + $this->folderService = $this->getMockBuilder(FolderServiceV2::class) ->disableOriginalConstructor() ->getMock(); $this->itemService = $this->getMockBuilder(ItemService::class) @@ -102,11 +103,11 @@ class FolderApiControllerTest extends TestCase $folder->setName($folderName); $this->folderService->expects($this->once()) - ->method('purgeDeleted') - ->with($this->equalTo($this->user->getUID()), $this->equalTo(false)); + ->method('purgeDeleted'); + $this->folderService->expects($this->once()) ->method('create') - ->with($this->equalTo($folderName), $this->equalTo($this->user->getUID())) + ->with($this->user->getUID(), $folderName) ->will($this->returnValue($folder)); $response = $this->folderAPI->create($folderName); @@ -124,8 +125,8 @@ class FolderApiControllerTest extends TestCase $msg = 'exists'; $this->folderService->expects($this->once()) - ->method('purgeDeleted') - ->with($this->equalTo($this->user->getUID()), $this->equalTo(false)); + ->method('purgeDeleted'); + $this->folderService->expects($this->once()) ->method('create') ->will($this->throwException(new ServiceConflictException($msg))); @@ -143,8 +144,8 @@ class FolderApiControllerTest extends TestCase $msg = 'exists'; $this->folderService->expects($this->once()) - ->method('purgeDeleted') - ->with($this->equalTo($this->user->getUID()), $this->equalTo(false)); + ->method('purgeDeleted'); + $this->folderService->expects($this->once()) ->method('create') ->will($this->throwException(new ServiceValidationException($msg))); @@ -161,10 +162,9 @@ class FolderApiControllerTest extends TestCase public function testDelete() { - $folderId = 23; $this->folderService->expects($this->once()) ->method('delete') - ->with($this->equalTo($folderId), $this->equalTo($this->user->getUID())); + ->with($this->user->getUID(), 23); $this->folderAPI->delete(23); } @@ -197,11 +197,7 @@ class FolderApiControllerTest extends TestCase $this->folderService->expects($this->once()) ->method('rename') - ->with( - $this->equalTo($folderId), - $this->equalTo($folderName), - $this->equalTo($this->user->getUID()) - ); + ->with($this->user->getUID(), $folderId, $folderName); $this->folderAPI->update($folderId, $folderName); } |