Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
test: add test for nested jail cross-storage move
Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 authored and backportbot[bot] committed Oct 29, 2024
commit accf7076591bfee843a00a5f2bab7c648f6eb453
23 changes: 23 additions & 0 deletions tests/lib/Files/Storage/LocalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

namespace Test\Files\Storage;

use OC\Files\Storage\Wrapper\Jail;

/**
* Class LocalTest
*
Expand Down Expand Up @@ -150,4 +152,25 @@ public function testUnavailableNonExternal() {
// 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'));
}
}