diff options
author | Robin Appelman <icewind@owncloud.com> | 2012-11-21 23:18:58 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2012-11-22 12:45:29 +0100 |
commit | 8687e0d346e7dad6890982c1a7b08befd8998aeb (patch) | |
tree | e8a6b3c3c8480cb88e9b4cd770f4828bf6fcc541 /tests | |
parent | 186c9e77e89dcd057a311ed08df9e1bb9e13ea8f (diff) | |
download | nextcloud-server-8687e0d346e7dad6890982c1a7b08befd8998aeb.tar.gz nextcloud-server-8687e0d346e7dad6890982c1a7b08befd8998aeb.zip |
add Scanner->backgroundScan
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/files/cache/scanner.php | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/lib/files/cache/scanner.php b/tests/lib/files/cache/scanner.php index c53da92727c..6d26150d82b 100644 --- a/tests/lib/files/cache/scanner.php +++ b/tests/lib/files/cache/scanner.php @@ -104,6 +104,28 @@ class Scanner extends \UnitTestCase { $this->assertNotEqual($cachedDataFolder['size'], -1); } + function testBackgroundScan(){ + $this->fillTestFolders(); + $this->storage->mkdir('folder2'); + $this->storage->file_put_contents('folder2/bar.txt', 'foobar'); + + $this->scanner->scan('', \OC\Files\Cache\Scanner::SCAN_SHALLOW); + $this->assertFalse($this->cache->inCache('folder/bar.txt')); + $this->assertFalse($this->cache->inCache('folder/2bar.txt')); + $cachedData = $this->cache->get(''); + $this->assertEquals(-1, $cachedData['size']); + + $this->scanner->backgroundScan(); + + $this->assertTrue($this->cache->inCache('folder/bar.txt')); + $this->assertTrue($this->cache->inCache('folder/bar.txt')); + + $cachedData = $this->cache->get(''); + $this->assertnotEquals(-1, $cachedData['size']); + + $this->assertFalse($this->cache->getIncomplete()); + } + function setUp() { $this->storage = new \OC\Files\Storage\Temporary(array()); $this->scanner = new \OC\Files\Cache\Scanner($this->storage); |