Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2020-01-14 12:57:54 +0300
committerRobin Appelman <robin@icewind.nl>2020-01-14 13:03:14 +0300
commit47fd6730e0da7d15d5cd0ef550ce2c957208f8eb (patch)
tree1be46e13b78f7391c07fdf5792ab8aa85c751181 /tests
parent950856d5bbd46e6d4a608c46c40631487f13c5e0 (diff)
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')
-rw-r--r--tests/lib/DirectEditing/ManagerTest.php12
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');
}