summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-01-15 01:31:33 -0800
committerVincent Petry <pvince81@owncloud.com>2014-01-15 01:31:33 -0800
commit34559ef11428c9a2a1b83f8a63d650d1fa0be49e (patch)
treecfc4f03bdb4aa479717159779bd0fc418437fd8f /tests
parent25fecb4f25ce5d229a075046a5a985f22dc7f830 (diff)
parent16b898ddb8bed50dca57472526d56a87a3b19c94 (diff)
downloadnextcloud-server-34559ef11428c9a2a1b83f8a63d650d1fa0be49e.tar.gz
nextcloud-server-34559ef11428c9a2a1b83f8a63d650d1fa0be49e.zip
Merge pull request #6768 from owncloud/scanner-use-storage-mtime
Use storage_mtime when determining if we can reuse cached data while scanning
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/files/cache/scanner.php2
-rw-r--r--tests/lib/files/cache/updater.php2
-rw-r--r--tests/lib/files/view.php17
3 files changed, 19 insertions, 2 deletions
diff --git a/tests/lib/files/cache/scanner.php b/tests/lib/files/cache/scanner.php
index 3f3a045377a..3f5604b4d45 100644
--- a/tests/lib/files/cache/scanner.php
+++ b/tests/lib/files/cache/scanner.php
@@ -147,7 +147,7 @@ class Scanner extends \PHPUnit_Framework_TestCase {
$this->scanner->scan('');
$oldData = $this->cache->get('');
$this->storage->unlink('folder/bar.txt');
- $this->cache->put('folder', array('mtime' => $this->storage->filemtime('folder')));
+ $this->cache->put('folder', array('mtime' => $this->storage->filemtime('folder'), 'storage_mtime' => $this->storage->filemtime('folder')));
$this->scanner->scan('', \OC\Files\Cache\Scanner::SCAN_SHALLOW, \OC\Files\Cache\Scanner::REUSE_SIZE);
$newData = $this->cache->get('');
$this->assertNotEquals($oldData['etag'], $newData['etag']);
diff --git a/tests/lib/files/cache/updater.php b/tests/lib/files/cache/updater.php
index 91e384e12af..48986149a73 100644
--- a/tests/lib/files/cache/updater.php
+++ b/tests/lib/files/cache/updater.php
@@ -88,7 +88,7 @@ class Updater extends \PHPUnit_Framework_TestCase {
public function testWrite() {
$textSize = strlen("dummy file data\n");
$imageSize = filesize(\OC::$SERVERROOT . '/core/img/logo.png');
- $this->cache->put('foo.txt', array('mtime' => 100));
+ $this->cache->put('foo.txt', array('mtime' => 100, 'storage_mtime' => 150));
$rootCachedData = $this->cache->get('');
$this->assertEquals(3 * $textSize + $imageSize, $rootCachedData['size']);
diff --git a/tests/lib/files/view.php b/tests/lib/files/view.php
index 76a7fd5f1ca..72a2f854cb2 100644
--- a/tests/lib/files/view.php
+++ b/tests/lib/files/view.php
@@ -545,4 +545,21 @@ class View extends \PHPUnit_Framework_TestCase {
$this->assertContains($item['name'], $names);
}
}
+
+ public function testTouchNotSupported() {
+ $storage = new TemporaryNoTouch(array());
+ $scanner = $storage->getScanner();
+ \OC\Files\Filesystem::mount($storage, array(), '/test/');
+ $past = time() - 100;
+ $storage->file_put_contents('test', 'foobar');
+ $scanner->scan('');
+ $view = new \OC\Files\View('');
+ $info = $view->getFileInfo('/test/test');
+
+ $view->touch('/test/test', $past);
+ $scanner->scanFile('test', \OC\Files\Cache\Scanner::REUSE_ETAG);
+
+ $info2 = $view->getFileInfo('/test/test');
+ $this->assertEquals($info['etag'], $info2['etag']);
+ }
}