Skip to content

Commit cef863a

Browse files
committed
test: add test for nested jail cross-storage move
Signed-off-by: Robin Appelman <[email protected]>
1 parent 309f65b commit cef863a

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/lib/Files/Storage/LocalTest.php

+23
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
namespace Test\Files\Storage;
99

10+
use OC\Files\Storage\Wrapper\Jail;
11+
1012
/**
1113
* Class LocalTest
1214
*
@@ -135,4 +137,25 @@ public function testUnavailableNonExternal() {
135137
// no exception thrown
136138
$this->assertNotNull($this->instance);
137139
}
140+
141+
public function testMoveNestedJail(): void {
142+
$this->instance->mkdir('foo');
143+
$this->instance->mkdir('foo/bar');
144+
$this->instance->mkdir('target');
145+
$this->instance->file_put_contents('foo/bar/file.txt', 'foo');
146+
$jail1 = new Jail([
147+
'storage' => $this->instance,
148+
'root' => 'foo'
149+
]);
150+
$jail2 = new Jail([
151+
'storage' => $jail1,
152+
'root' => 'bar'
153+
]);
154+
$jail3 = new Jail([
155+
'storage' => $this->instance,
156+
'root' => 'target'
157+
]);
158+
$jail3->moveFromStorage($jail2, 'file.txt', 'file.txt');
159+
$this->assertTrue($this->instance->file_exists('target/file.txt'));
160+
}
138161
}

0 commit comments

Comments
 (0)