diff options
Diffstat (limited to 'tests/lib/Files/Cache/ScannerTest.php')
-rw-r--r-- | tests/lib/Files/Cache/ScannerTest.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/lib/Files/Cache/ScannerTest.php b/tests/lib/Files/Cache/ScannerTest.php index 4a93f3ee014..b44b6f5d0f5 100644 --- a/tests/lib/Files/Cache/ScannerTest.php +++ b/tests/lib/Files/Cache/ScannerTest.php @@ -7,6 +7,7 @@ */ namespace Test\Files\Cache; + use OC\Files\Cache\CacheEntry; /** @@ -150,6 +151,32 @@ class ScannerTest extends \Test\TestCase { $this->assertFalse($this->cache->getIncomplete()); } + function testBackgroundScanOnlyRecurseIncomplete() { + $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')); + $this->assertFalse($this->cache->inCache('folder2/bar.txt')); + $this->cache->put('folder2', ['size' => 1]); // mark as complete + + $cachedData = $this->cache->get(''); + $this->assertEquals(-1, $cachedData['size']); + + $this->scanner->scan('', \OC\Files\Cache\Scanner::SCAN_RECURSIVE_INCOMPLETE, \OC\Files\Cache\Scanner::REUSE_ETAG | \OC\Files\Cache\Scanner::REUSE_SIZE); + + $this->assertTrue($this->cache->inCache('folder/bar.txt')); + $this->assertTrue($this->cache->inCache('folder/bar.txt')); + $this->assertFalse($this->cache->inCache('folder2/bar.txt')); + + $cachedData = $this->cache->get(''); + $this->assertNotEquals(-1, $cachedData['size']); + + $this->assertFalse($this->cache->getIncomplete()); + } + public function testReuseExisting() { $this->fillTestFolders(); |