diff options
author | Robin Appelman <icewind@owncloud.com> | 2012-12-15 03:10:56 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2012-12-15 03:10:56 +0100 |
commit | 4be039e6cbc0a826b07fc2af1a6c6d94888a9187 (patch) | |
tree | facd0f5e7cb38c7ae0c7a84a5d29cfc1e4fc5173 /tests | |
parent | bc52f121626bb1bb1f67bc1f876d0420d153b3d1 (diff) | |
download | nextcloud-server-4be039e6cbc0a826b07fc2af1a6c6d94888a9187.tar.gz nextcloud-server-4be039e6cbc0a826b07fc2af1a6c6d94888a9187.zip |
Filecache Watcher: use scan or scanFile based on the current item, not the cached item
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/files/cache/watcher.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/lib/files/cache/watcher.php b/tests/lib/files/cache/watcher.php index 0125dd843b9..07c8ac3640c 100644 --- a/tests/lib/files/cache/watcher.php +++ b/tests/lib/files/cache/watcher.php @@ -63,6 +63,40 @@ class Watcher extends \PHPUnit_Framework_TestCase { $this->assertFalse($cache->inCache('folder/bar2.txt')); } + public function testFileToFolder() { + $storage = $this->getTestStorage(); + $cache = $storage->getCache(); + $updater = new \OC\Files\Cache\Watcher($storage); + + //set the mtime to the past so it can detect an mtime change + $cache->put('', array('mtime' => 10)); + + $storage->unlink('foo.txt'); + $storage->rename('folder','foo.txt'); + $updater->checkUpdate(''); + + $entry= $cache->get('foo.txt'); + $this->assertEquals(-1, $entry['size']); + $this->assertEquals('httpd/unix-directory', $entry['mimetype']); + $this->assertFalse($cache->inCache('folder')); + $this->assertFalse($cache->inCache('folder/bar.txt')); + + $storage = $this->getTestStorage(); + $cache = $storage->getCache(); + $updater = new \OC\Files\Cache\Watcher($storage); + + //set the mtime to the past so it can detect an mtime change + $cache->put('foo.txt', array('mtime' => 10)); + + $storage->unlink('foo.txt'); + $storage->rename('folder','foo.txt'); + $updater->checkUpdate('foo.txt'); + + $entry= $cache->get('foo.txt'); + $this->assertEquals('httpd/unix-directory', $entry['mimetype']); + $this->assertTrue($cache->inCache('foo.txt/bar.txt')); + } + /** * @param bool $scan * @return \OC\Files\Storage\Storage |