diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2021-04-01 15:11:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-01 15:11:25 +0200 |
commit | 507facda8b63ac12d2938fe6095d14a0d8d797f7 (patch) | |
tree | 1c546c79c050dc6568a2de65d5de8e09494d3564 /tests | |
parent | 037411b3815bb11e009d7356e5254614a48c3e7a (diff) | |
parent | 6fd571461c32fc46c63943454c5087064a96b759 (diff) | |
download | nextcloud-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.php | 22 |
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'); |