diff options
author | Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com> | 2024-04-09 14:07:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-09 14:07:49 +0200 |
commit | d8c5f1c9a5bb30038c88bd1ee266116d47b92d4c (patch) | |
tree | b7e6bbc5e634c068e21298ed68b0c0c067878ef7 /tests | |
parent | ad2c84118e46164c3bec99af865167f2aa97012a (diff) | |
parent | 85d76200333b8f9dd91876cb5f923bc8515f1768 (diff) | |
download | nextcloud-server-d8c5f1c9a5bb30038c88bd1ee266116d47b92d4c.tar.gz nextcloud-server-d8c5f1c9a5bb30038c88bd1ee266116d47b92d4c.zip |
Merge pull request #44749 from nextcloud/backport/44730/stable27
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/Files/Cache/Wrapper/CacheJailTest.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/lib/Files/Cache/Wrapper/CacheJailTest.php b/tests/lib/Files/Cache/Wrapper/CacheJailTest.php index 4c3dce74087..21a884d3427 100644 --- a/tests/lib/Files/Cache/Wrapper/CacheJailTest.php +++ b/tests/lib/Files/Cache/Wrapper/CacheJailTest.php @@ -11,6 +11,7 @@ namespace Test\Files\Cache\Wrapper; use OC\Files\Cache\Wrapper\CacheJail; use OC\Files\Search\SearchComparison; use OC\Files\Search\SearchQuery; +use OC\Files\Storage\Wrapper\Jail; use OC\User\User; use OCP\Files\Search\ISearchComparison; use Symfony\Component\EventDispatcher\EventDispatcherInterface; @@ -218,4 +219,33 @@ class CacheJailTest extends CacheTest { $this->assertCount(1, $result); $this->assertEquals('foo/bar/asd', $result[0]['path']); } + + public function testWatcher() { + $storage = new Jail([ + 'storage' => $this->storage, + 'root' => 'foo' + ]); + $storage->getScanner()->scan(''); + $storage->file_put_contents('bar', 'asd'); + + $this->assertFalse($this->cache->inCache('bar')); + $storage->getWatcher()->update('bar', ['mimetype' => 'text/plain']); + $this->assertTrue($this->cache->inCache('bar')); + } + + public function testWatcherAfterInnerWatcher() { + $storage = new Jail([ + 'storage' => $this->storage, + 'root' => 'foo' + ]); + $storage->getScanner()->scan(''); + $storage->file_put_contents('bar', 'asd'); + + // let the underlying storage create it's watcher first + $this->storage->getWatcher(); + + $this->assertFalse($this->cache->inCache('bar')); + $storage->getWatcher()->update('bar', ['mimetype' => 'text/plain']); + $this->assertTrue($this->cache->inCache('bar')); + } } |