diff options
author | Paul Tirk <paultirk@paultirk.com> | 2021-01-09 18:25:52 +0100 |
---|---|---|
committer | Sean Molenaar <SMillerDev@users.noreply.github.com> | 2021-04-08 10:23:11 +0200 |
commit | eb849a9be5780434ed025b8c42ba08b0600e7733 (patch) | |
tree | 629a0cbb73d83d6a213ef6afebdf40ee543d469f /tests | |
parent | 26e435fb0563616e5ef0c83af4a6bc2546b95d6e (diff) |
do not return existing folders when an API request error occurs
Signed-off-by: Paul Tirk <paultirk@paultirk.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Unit/Controller/FolderApiV2ControllerTest.php | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/tests/Unit/Controller/FolderApiV2ControllerTest.php b/tests/Unit/Controller/FolderApiV2ControllerTest.php index 06b11c099..d91a32bea 100644 --- a/tests/Unit/Controller/FolderApiV2ControllerTest.php +++ b/tests/Unit/Controller/FolderApiV2ControllerTest.php @@ -98,29 +98,15 @@ class FolderApiV2ControllerTest extends TestCase public function testCreateAlreadyExists() { - $existingFolder = new Folder(); - $folderName = 'hi'; - $this->folderService->expects($this->once()) ->method('purgeDeleted') ->with($this->equalTo($this->user->getUID()), $this->equalTo(false)); $this->folderService->expects($this->once()) ->method('create') ->will($this->throwException(new ServiceConflictException('exists'))); - $this->folderService->expects($this->once()) - ->method('findByName') - ->with($this->equalTo(($this->user->getUID()), $this->equalTo($folderName))) - ->will($this->returnValue($existingFolder)); $response = $this->folderAPI->createFolder('hi'); - $data = $response->getData(); - $this->assertEquals( - [ - 'folder' => $existingFolder->toAPI2() - ], - $data - ); $this->assertEquals(Http::STATUS_CONFLICT, $response->getStatus()); } @@ -229,7 +215,6 @@ class FolderApiV2ControllerTest extends TestCase { $folderId = 23; $folderName = 'test'; - $existingFolder = new Folder(); $this->folderService->expects($this->once()) ->method('rename') @@ -238,23 +223,9 @@ class FolderApiV2ControllerTest extends TestCase new ServiceConflictException($this->msg) ) ); - $this->folderService->expects($this->once()) - ->method('findByName') - ->with( - $this->equalTo($this->user->getUID()), - $this->equalTo($folderName) - ) - ->will($this->returnValue($existingFolder)); $response = $this->folderAPI->updateFolder($folderId, $folderName); - $data = $response->getData(); - $this->assertEquals( - [ - 'folder' => $existingFolder->toAPI2() - ], - $data - ); $this->assertEquals(Http::STATUS_CONFLICT, $response->getStatus()); } |