aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2024-10-02 17:00:53 +0200
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2024-10-29 10:41:24 +0000
commita61d2ab4c4795f8e8df2b0a6c7baa844296ddc18 (patch)
tree18b6012c7da62cde7657e36b662e2eea198050ae /tests
parent6f962c75d4c90a6277425848707c72df4cb09831 (diff)
downloadnextcloud-server-a61d2ab4c4795f8e8df2b0a6c7baa844296ddc18.tar.gz
nextcloud-server-a61d2ab4c4795f8e8df2b0a6c7baa844296ddc18.zip
test: add test for nested jail cross-storage movebackport/47847/stable29
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Files/Storage/LocalTest.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/lib/Files/Storage/LocalTest.php b/tests/lib/Files/Storage/LocalTest.php
index 1190a2b2da0..adee2e8253d 100644
--- a/tests/lib/Files/Storage/LocalTest.php
+++ b/tests/lib/Files/Storage/LocalTest.php
@@ -22,6 +22,8 @@
namespace Test\Files\Storage;
+use OC\Files\Storage\Wrapper\Jail;
+
/**
* Class LocalTest
*
@@ -150,4 +152,25 @@ class LocalTest extends Storage {
// no exception thrown
$this->assertNotNull($this->instance);
}
+
+ public function testMoveNestedJail(): void {
+ $this->instance->mkdir('foo');
+ $this->instance->mkdir('foo/bar');
+ $this->instance->mkdir('target');
+ $this->instance->file_put_contents('foo/bar/file.txt', 'foo');
+ $jail1 = new Jail([
+ 'storage' => $this->instance,
+ 'root' => 'foo'
+ ]);
+ $jail2 = new Jail([
+ 'storage' => $jail1,
+ 'root' => 'bar'
+ ]);
+ $jail3 = new Jail([
+ 'storage' => $this->instance,
+ 'root' => 'target'
+ ]);
+ $jail3->moveFromStorage($jail2, 'file.txt', 'file.txt');
+ $this->assertTrue($this->instance->file_exists('target/file.txt'));
+ }
}