aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorprovokateurin <kate@provokateurin.de>2024-08-22 12:04:31 +0200
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2024-09-04 18:02:56 +0000
commit77c38979c60c3dfa1765e4a8f7472f46717fe427 (patch)
tree7f0667d4758ffcff0763a77c7ccaca1e34c9f76b /tests
parent0f4086c85a92a416b18f398e3c87f484ca800583 (diff)
downloadnextcloud-server-77c38979c60c3dfa1765e4a8f7472f46717fe427.tar.gz
nextcloud-server-77c38979c60c3dfa1765e4a8f7472f46717fe427.zip
fix(files): Create non-existent parents of mountpoints
Signed-off-by: provokateurin <kate@provokateurin.de>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Files/ViewTest.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/lib/Files/ViewTest.php b/tests/lib/Files/ViewTest.php
index f67c4e9642b..16568e74a06 100644
--- a/tests/lib/Files/ViewTest.php
+++ b/tests/lib/Files/ViewTest.php
@@ -2743,4 +2743,35 @@ class ViewTest extends \Test\TestCase {
$this->assertFalse($cache->inCache('foo.txt'));
}
+
+ public function testMountpointParentsCreated() {
+ $storage1 = $this->getTestStorage();
+ Filesystem::mount($storage1, [], '/');
+
+ $storage2 = $this->getTestStorage();
+ Filesystem::mount($storage2, [], '/A/B/C');
+
+ $rootView = new View('');
+
+ $folderData = $rootView->getDirectoryContent('/');
+ $this->assertCount(4, $folderData);
+ $this->assertEquals('folder', $folderData[0]['name']);
+ $this->assertEquals('foo.png', $folderData[1]['name']);
+ $this->assertEquals('foo.txt', $folderData[2]['name']);
+ $this->assertEquals('A', $folderData[3]['name']);
+
+ $folderData = $rootView->getDirectoryContent('/A');
+ $this->assertCount(1, $folderData);
+ $this->assertEquals('B', $folderData[0]['name']);
+
+ $folderData = $rootView->getDirectoryContent('/A/B');
+ $this->assertCount(1, $folderData);
+ $this->assertEquals('C', $folderData[0]['name']);
+
+ $folderData = $rootView->getDirectoryContent('/A/B/C');
+ $this->assertCount(3, $folderData);
+ $this->assertEquals('folder', $folderData[0]['name']);
+ $this->assertEquals('foo.png', $folderData[1]['name']);
+ $this->assertEquals('foo.txt', $folderData[2]['name']);
+ }
}