diff options
author | Julius Härtl <jus@bitgrid.net> | 2021-03-31 15:44:47 +0200 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2021-04-01 13:48:21 +0200 |
commit | 37591f05dca56090059c4356636406c8982d3f33 (patch) | |
tree | 71d59b4a27d5c44a765060ec33a2a0c26b484fed /tests/lib/DirectEditing | |
parent | bd2e6309b5b7719f42f10097ffdef09bcb7447dd (diff) | |
download | nextcloud-server-37591f05dca56090059c4356636406c8982d3f33.tar.gz nextcloud-server-37591f05dca56090059c4356636406c8982d3f33.zip |
Get the parent directory before creating a file from a template
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'tests/lib/DirectEditing')
-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'); |