diff options
author | Robin Appelman <icewind@owncloud.com> | 2012-10-03 11:40:09 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2012-10-03 11:40:09 +0200 |
commit | 85be00be6595a3af168f6df963ffdeac8c3c6d5e (patch) | |
tree | c8d37a785b7391d8363ca6c25d309d9993f102cb /tests/lib/files/cache/scanner.php | |
parent | 3c8e5ea3581cbbfc5acd3c229080bc63548d2827 (diff) | |
download | nextcloud-server-85be00be6595a3af168f6df963ffdeac8c3c6d5e.tar.gz nextcloud-server-85be00be6595a3af168f6df963ffdeac8c3c6d5e.zip |
add some more test cases for the scanner
Diffstat (limited to 'tests/lib/files/cache/scanner.php')
-rw-r--r-- | tests/lib/files/cache/scanner.php | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/tests/lib/files/cache/scanner.php b/tests/lib/files/cache/scanner.php index 3d1c1546ab0..7ee28dfc3fd 100644 --- a/tests/lib/files/cache/scanner.php +++ b/tests/lib/files/cache/scanner.php @@ -33,6 +33,27 @@ class Scanner extends \UnitTestCase { $cachedData = $this->cache->get('foo.txt'); $this->assertEqual($cachedData['size'], strlen($data)); $this->assertEqual($cachedData['mimetype'], 'text/plain'); + $this->assertNotEqual($cachedData['parent'], -1); //parent folders should be scanned automatically + + $data = file_get_contents(\OC::$SERVERROOT . '/core/img/logo.png'); + $this->storage->file_put_contents('foo.png', $data); + $this->scanner->scanFile('foo.png'); + + $this->assertEqual($this->cache->inCache('foo.png'), true); + $cachedData = $this->cache->get('foo.png'); + $this->assertEqual($cachedData['size'], strlen($data)); + $this->assertEqual($cachedData['mimetype'], 'image/png'); + } + + function testFolder() { + $textData = "dummy file data\n"; + $imgData = file_get_contents(\OC::$SERVERROOT . '/core/img/logo.png'); + $this->storage->file_put_contents('foo.txt', $textData); + $this->storage->file_put_contents('foo.png', $imgData); + + $this->scanner->scan(''); + $this->assertEqual($this->cache->inCache('foo.txt'), true); + $this->assertEqual($this->cache->inCache('foo.png'), true); } function setUp() { @@ -42,6 +63,6 @@ class Scanner extends \UnitTestCase { } function tearDown() { -// $this->cache->clear(); + $this->cache->clear(); } } |