mirror of
https://github.com/nextcloud/server.git
synced 2026-04-21 22:27:31 -04:00
test: add test for jail watcher
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
6c142a3cd5
commit
338c8aaea4
1 changed files with 30 additions and 0 deletions
|
|
@ -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\EventDispatcher\IEventDispatcher;
|
||||
use OCP\Files\Search\ISearchComparison;
|
||||
|
|
@ -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'));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue