diff options
author | Robin Appelman <icewind@owncloud.com> | 2014-10-14 17:15:46 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2014-11-07 12:56:09 +0100 |
commit | d26a427f92259ab067da64803c00e7f1589060b0 (patch) | |
tree | 3729bb0ab7ec12649a343111364f7742a8bf9c13 /tests/lib | |
parent | e345697cabd6670e652f4bba7b91269e4efcd794 (diff) | |
download | nextcloud-server-d26a427f92259ab067da64803c00e7f1589060b0.tar.gz nextcloud-server-d26a427f92259ab067da64803c00e7f1589060b0.zip |
Also propagate etag changes when the watcher finds a changed file
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/files/view.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/lib/files/view.php b/tests/lib/files/view.php index 5f030f29fa7..086ac873bfb 100644 --- a/tests/lib/files/view.php +++ b/tests/lib/files/view.php @@ -8,6 +8,7 @@ namespace Test\Files; use OC\Files\Cache\Watcher; +use OC\Files\Storage\Temporary; class TemporaryNoTouch extends \OC\Files\Storage\Temporary { public function touch($path, $mtime = null) { @@ -652,6 +653,36 @@ class View extends \PHPUnit_Framework_TestCase { $this->assertSame($info['etag'], $info2['etag']); } + public function testWatcherEtagCrossStorage() { + $storage1 = new Temporary(array()); + $storage2 = new Temporary(array()); + $scanner1 = $storage1->getScanner(); + $scanner2 = $storage2->getScanner(); + $storage1->mkdir('sub'); + \OC\Files\Filesystem::mount($storage1, array(), '/test/'); + \OC\Files\Filesystem::mount($storage2, array(), '/test/sub/storage'); + + $past = time() - 100; + $storage2->file_put_contents('test.txt', 'foobar'); + $scanner1->scan(''); + $scanner2->scan(''); + $view = new \OC\Files\View(''); + + $storage2->getWatcher('')->setPolicy(Watcher::CHECK_ALWAYS); + + $oldFileInfo = $view->getFileInfo('/test/sub/storage/test.txt'); + $oldFolderInfo = $view->getFileInfo('/test'); + + $storage2->getCache()->update($oldFileInfo->getId(), array( + 'storage_mtime' => $past + )); + + $view->getFileInfo('/test/sub/storage/test.txt'); + $newFolderInfo = $view->getFileInfo('/test'); + + $this->assertNotEquals($newFolderInfo->getEtag(), $oldFolderInfo->getEtag()); + } + /** * @dataProvider absolutePathProvider */ |