diff options
author | Robin Appelman <robin@icewind.nl> | 2020-01-14 10:57:54 +0100 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2020-01-14 11:03:14 +0100 |
commit | 47fd6730e0da7d15d5cd0ef550ce2c957208f8eb (patch) | |
tree | 1be46e13b78f7391c07fdf5792ab8aa85c751181 /tests/lib/DirectEditing | |
parent | 950856d5bbd46e6d4a608c46c40631487f13c5e0 (diff) | |
download | nextcloud-server-47fd6730e0da7d15d5cd0ef550ce2c957208f8eb.tar.gz nextcloud-server-47fd6730e0da7d15d5cd0ef550ce2c957208f8eb.zip |
use `nodeExists` instead of catching exceptions
makes the intent of the code more clear imo
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'tests/lib/DirectEditing')
-rw-r--r-- | tests/lib/DirectEditing/ManagerTest.php | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/lib/DirectEditing/ManagerTest.php b/tests/lib/DirectEditing/ManagerTest.php index 1f18a25115f..737a41425e1 100644 --- a/tests/lib/DirectEditing/ManagerTest.php +++ b/tests/lib/DirectEditing/ManagerTest.php @@ -153,9 +153,9 @@ class ManagerTest extends TestCase { ->method('generate') ->willReturn($expectedToken); $this->userFolder - ->method('get') + ->method('nodeExists') ->with('/File.txt') - ->willThrowException(new NotFoundException()); + ->willReturn(false); $this->userFolder->expects($this->once()) ->method('newFile') ->willReturn($file); @@ -173,9 +173,9 @@ class ManagerTest extends TestCase { ->method('generate') ->willReturn($expectedToken); $this->userFolder - ->method('get') + ->method('nodeExists') ->with('/File.txt') - ->willThrowException(new NotFoundException()); + ->willReturn(false); $this->userFolder->expects($this->once()) ->method('newFile') ->willReturn($file); @@ -188,6 +188,10 @@ class ManagerTest extends TestCase { public function testCreateFileAlreadyExists() { $this->expectException(\RuntimeException::class); + $this->userFolder + ->method('nodeExists') + ->with('/File.txt') + ->willReturn(true); $this->manager->create('/File.txt', 'testeditor', 'createEmpty'); } |