test: add test for nested cache jail unjailedroot

Signed-off-by: Robin Appelman <robin@icewind.nl>
pull/52775/head
Robin Appelman 12 months ago
parent b9da9416be
commit 0001c22668
  1. 2
      lib/private/Files/Cache/Wrapper/CacheJail.php
  2. 11
      tests/lib/Files/Cache/Wrapper/CacheJailTest.php

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

@ -8,6 +8,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;
@ -252,4 +253,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());
}
}

Loading…
Cancel
Save