diff options
author | Robin Appelman <robin@icewind.nl> | 2021-07-28 17:11:12 +0200 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2021-07-29 07:30:22 +0000 |
commit | 69e650d4b0013cd94d8a54c78dcefe9db56bfb90 (patch) | |
tree | 902f9c3b74eff6fb215f27403efe145f245076de /tests | |
parent | 1534b24e3802836f06637e11ee67fc9f5515a82d (diff) | |
download | nextcloud-server-69e650d4b0013cd94d8a54c78dcefe9db56bfb90.tar.gz nextcloud-server-69e650d4b0013cd94d8a54c78dcefe9db56bfb90.zip |
add test for searching within a "root jail"
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/Files/Cache/Wrapper/CacheJailTest.php | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/lib/Files/Cache/Wrapper/CacheJailTest.php b/tests/lib/Files/Cache/Wrapper/CacheJailTest.php index d9f7af1f034..4c3dce74087 100644 --- a/tests/lib/Files/Cache/Wrapper/CacheJailTest.php +++ b/tests/lib/Files/Cache/Wrapper/CacheJailTest.php @@ -200,4 +200,22 @@ class CacheJailTest extends CacheTest { $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']); + } } |