aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2021-04-01 15:11:25 +0200
committerGitHub <noreply@github.com>2021-04-01 15:11:25 +0200
commit507facda8b63ac12d2938fe6095d14a0d8d797f7 (patch)
tree1c546c79c050dc6568a2de65d5de8e09494d3564 /tests
parent037411b3815bb11e009d7356e5254614a48c3e7a (diff)
parent6fd571461c32fc46c63943454c5087064a96b759 (diff)
downloadnextcloud-server-507facda8b63ac12d2938fe6095d14a0d8d797f7.tar.gz
nextcloud-server-507facda8b63ac12d2938fe6095d14a0d8d797f7.zip
Merge pull request #26396 from nextcloud/bugfix/noid/ro-root-template
Get the parent directory before creating a file from a template
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');