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
Next Next commit
add test for searching within a "root jail"
Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 authored and backportbot[bot] committed Jul 29, 2021
commit f23a053f82acdee534b409b353d8a6e8325822e4
18 changes: 18 additions & 0 deletions tests/lib/Files/Cache/Wrapper/CacheJailTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,4 +200,22 @@ public function testSearchNested() {
$this->assertCount(1, $result);
$this->assertEquals('asd', $result[0]['path']);
}

public function testRootJail() {
$this->storage->getScanner()->scan('');
$file1 = 'foo';
$file2 = 'foo/bar';
$file3 = 'foo/bar/asd';
$data1 = ['size' => 100, 'mtime' => 50, 'mimetype' => 'foo/folder'];

$this->sourceCache->put($file1, $data1);
$this->sourceCache->put($file2, $data1);
$this->sourceCache->put($file3, $data1);

$nested = new \OC\Files\Cache\Wrapper\CacheJail($this->sourceCache, '');

$result = $nested->search('%asd%');
$this->assertCount(1, $result);
$this->assertEquals('foo/bar/asd', $result[0]['path']);
}
}