test: add test for nested cache jail unjailedroot

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2025-05-12 18:32:38 +02:00
parent 0b626f5d21
commit e5aabded60
2 changed files with 12 additions and 1 deletions

View file

@ -51,7 +51,7 @@ class CacheJail extends CacheWrapper {
*
* @return string
*/
protected function getGetUnjailedRoot() {
public function getGetUnjailedRoot() {
return $this->unjailedRoot;
}

View file

@ -9,6 +9,7 @@
namespace Test\Files\Cache\Wrapper;
use OC\Files\Cache\Wrapper\CacheJail;
use OC\Files\Cache\Wrapper\CacheWrapper;
use OC\Files\Search\SearchComparison;
use OC\Files\Search\SearchQuery;
use OC\Files\Storage\Wrapper\Jail;
@ -253,4 +254,14 @@ class CacheJailTest extends CacheTest {
$storage->getWatcher()->update('bar', ['mimetype' => 'text/plain']);
$this->assertTrue($this->cache->inCache('bar'));
}
public function testUnJailedRoot(): void {
$jail1 = new CacheJail($this->sourceCache, 'foo');
$jail2 = new CacheJail($jail1, 'bar');
$this->assertEquals('foo/bar', $jail2->getGetUnjailedRoot());
$middleWrapper = new CacheWrapper($jail1);
$jail3 = new CacheJail($middleWrapper, 'bar');
$this->assertEquals('foo/bar', $jail3->getGetUnjailedRoot());
}
}