aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/files/cache/scanner.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2013-08-12 15:37:15 +0200
committerRobin Appelman <icewind@owncloud.com>2013-08-12 15:37:15 +0200
commit1877a42a0dead02b7593f2b3166583106f32acb0 (patch)
treefbcbdadf9fe9834eb9ff80ccaa2ef98846d6f6de /tests/lib/files/cache/scanner.php
parent5ebff8cfc453552201f0bde1b0eeba13f540d0a6 (diff)
downloadnextcloud-server-1877a42a0dead02b7593f2b3166583106f32acb0.tar.gz
nextcloud-server-1877a42a0dead02b7593f2b3166583106f32acb0.zip
Scanner: additional tests for reusing etags during scanning
Diffstat (limited to 'tests/lib/files/cache/scanner.php')
-rw-r--r--tests/lib/files/cache/scanner.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/lib/files/cache/scanner.php b/tests/lib/files/cache/scanner.php
index 263ceadccc7..f6deb93a49e 100644
--- a/tests/lib/files/cache/scanner.php
+++ b/tests/lib/files/cache/scanner.php
@@ -143,6 +143,24 @@ class Scanner extends \PHPUnit_Framework_TestCase {
$newData = $this->cache->get('');
$this->assertEquals($oldData['etag'], $newData['etag']);
$this->assertEquals(-1, $newData['size']);
+
+ $this->scanner->scan('', \OC\Files\Cache\Scanner::SCAN_RECURSIVE);
+ $oldData = $this->cache->get('');
+ $this->assertNotEquals(-1, $oldData['size']);
+ $this->scanner->scanFile('', \OC\Files\Cache\Scanner::REUSE_ETAG + \OC\Files\Cache\Scanner::REUSE_SIZE);
+ $newData = $this->cache->get('');
+ $this->assertEquals($oldData['etag'], $newData['etag']);
+ $this->assertEquals($oldData['size'], $newData['size']);
+
+ $this->scanner->scan('', \OC\Files\Cache\Scanner::SCAN_RECURSIVE, \OC\Files\Cache\Scanner::REUSE_ETAG + \OC\Files\Cache\Scanner::REUSE_SIZE);
+ $newData = $this->cache->get('');
+ $this->assertEquals($oldData['etag'], $newData['etag']);
+ $this->assertEquals($oldData['size'], $newData['size']);
+
+ $this->scanner->scan('', \OC\Files\Cache\Scanner::SCAN_SHALLOW, \OC\Files\Cache\Scanner::REUSE_ETAG + \OC\Files\Cache\Scanner::REUSE_SIZE);
+ $newData = $this->cache->get('');
+ $this->assertEquals($oldData['etag'], $newData['etag']);
+ $this->assertEquals($oldData['size'], $newData['size']);
}
public function testRemovedFile() {