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:
authorJulius Härtl <jus@bitgrid.net>2021-03-31 16:44:47 +0300
committerJulius Härtl <jus@bitgrid.net>2021-04-01 14:48:21 +0300
commit37591f05dca56090059c4356636406c8982d3f33 (patch)
tree71d59b4a27d5c44a765060ec33a2a0c26b484fed /tests
parentbd2e6309b5b7719f42f10097ffdef09bcb7447dd (diff)
Get the parent directory before creating a file from a template
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/DirectEditing/ManagerTest.php22
1 files changed, 16 insertions, 6 deletions
diff --git a/tests/lib/DirectEditing/ManagerTest.php b/tests/lib/DirectEditing/ManagerTest.php
index 73bb4a836d8..b00de02bcf5 100644
--- a/tests/lib/DirectEditing/ManagerTest.php
+++ b/tests/lib/DirectEditing/ManagerTest.php
@@ -154,11 +154,16 @@ class ManagerTest extends TestCase {
$this->random->expects($this->once())
->method('generate')
->willReturn($expectedToken);
+ $folder = $this->createMock(Folder::class);
$this->userFolder
->method('nodeExists')
- ->with('/File.txt')
- ->willReturn(false);
- $this->userFolder->expects($this->once())
+ ->withConsecutive(['/File.txt'], ['/'])
+ ->willReturnOnConsecutiveCalls(false, true);
+ $this->userFolder
+ ->method('get')
+ ->with('/')
+ ->willReturn($folder);
+ $folder->expects($this->once())
->method('newFile')
->willReturn($file);
$token = $this->manager->create('/File.txt', 'testeditor', 'createEmpty');
@@ -174,11 +179,16 @@ class ManagerTest extends TestCase {
$this->random->expects($this->once())
->method('generate')
->willReturn($expectedToken);
+ $folder = $this->createMock(Folder::class);
$this->userFolder
->method('nodeExists')
- ->with('/File.txt')
- ->willReturn(false);
- $this->userFolder->expects($this->once())
+ ->withConsecutive(['/File.txt'], ['/'])
+ ->willReturnOnConsecutiveCalls(false, true);
+ $this->userFolder
+ ->method('get')
+ ->with('/')
+ ->willReturn($folder);
+ $folder->expects($this->once())
->method('newFile')
->willReturn($file);
$this->manager->create('/File.txt', 'testeditor', 'createEmpty');