Skip to content
Snippets Groups Projects
Commit f297bf14 authored by Robin Appelman's avatar Robin Appelman
Browse files

Fix unit tests

parent 6689d67a
Branches
No related tags found
No related merge requests found
...@@ -42,6 +42,7 @@ class Scanner extends \PHPUnit_Framework_TestCase { ...@@ -42,6 +42,7 @@ class Scanner extends \PHPUnit_Framework_TestCase {
public function testReuseExistingRoot() { public function testReuseExistingRoot() {
$storage = new Temporary(array()); $storage = new Temporary(array());
$mount = new Mount($storage, ''); $mount = new Mount($storage, '');
Filesystem::getMountManager()->addMount($mount);
$cache = $storage->getCache(); $cache = $storage->getCache();
$storage->mkdir('folder'); $storage->mkdir('folder');
...@@ -63,6 +64,7 @@ class Scanner extends \PHPUnit_Framework_TestCase { ...@@ -63,6 +64,7 @@ class Scanner extends \PHPUnit_Framework_TestCase {
public function testReuseExistingFile() { public function testReuseExistingFile() {
$storage = new Temporary(array()); $storage = new Temporary(array());
$mount = new Mount($storage, ''); $mount = new Mount($storage, '');
Filesystem::getMountManager()->addMount($mount);
$cache = $storage->getCache(); $cache = $storage->getCache();
$storage->mkdir('folder'); $storage->mkdir('folder');
......
...@@ -52,14 +52,18 @@ class View extends \PHPUnit_Framework_TestCase { ...@@ -52,14 +52,18 @@ class View extends \PHPUnit_Framework_TestCase {
$storage1 = $this->getTestStorage(); $storage1 = $this->getTestStorage();
$storage2 = $this->getTestStorage(); $storage2 = $this->getTestStorage();
$storage3 = $this->getTestStorage(); $storage3 = $this->getTestStorage();
\OC\Files\Filesystem::mount($storage1, array(), '/'); $root = '/' . uniqid();
\OC\Files\Filesystem::mount($storage2, array(), '/substorage'); \OC\Files\Filesystem::mount($storage1, array(), $root . '/');
\OC\Files\Filesystem::mount($storage3, array(), '/folder/anotherstorage'); \OC\Files\Filesystem::mount($storage2, array(), $root . '/substorage');
\OC\Files\Filesystem::mount($storage3, array(), $root . '/folder/anotherstorage');
$textSize = strlen("dummy file data\n"); $textSize = strlen("dummy file data\n");
$imageSize = filesize(\OC::$SERVERROOT . '/core/img/logo.png'); $imageSize = filesize(\OC::$SERVERROOT . '/core/img/logo.png');
$storageSize = $textSize * 2 + $imageSize; $storageSize = $textSize * 2 + $imageSize;
$rootView = new \OC\Files\View(''); $storageInfo = $storage3->getCache()->get('');
$this->assertEquals($storageSize, $storageInfo['size']);
$rootView = new \OC\Files\View($root);
$cachedData = $rootView->getFileInfo('/foo.txt'); $cachedData = $rootView->getFileInfo('/foo.txt');
$this->assertEquals($textSize, $cachedData['size']); $this->assertEquals($textSize, $cachedData['size']);
...@@ -110,7 +114,7 @@ class View extends \PHPUnit_Framework_TestCase { ...@@ -110,7 +114,7 @@ class View extends \PHPUnit_Framework_TestCase {
$this->assertEquals('foo.png', $folderData[1]['name']); $this->assertEquals('foo.png', $folderData[1]['name']);
$this->assertEquals('foo.txt', $folderData[2]['name']); $this->assertEquals('foo.txt', $folderData[2]['name']);
$folderView = new \OC\Files\View('/folder'); $folderView = new \OC\Files\View($root . '/folder');
$this->assertEquals($rootView->getFileInfo('/folder'), $folderView->getFileInfo('/')); $this->assertEquals($rootView->getFileInfo('/folder'), $folderView->getFileInfo('/'));
$cachedData = $rootView->getFileInfo('/foo.txt'); $cachedData = $rootView->getFileInfo('/foo.txt');
...@@ -652,7 +656,7 @@ class View extends \PHPUnit_Framework_TestCase { ...@@ -652,7 +656,7 @@ class View extends \PHPUnit_Framework_TestCase {
* @dataProvider tooLongPathDataProvider * @dataProvider tooLongPathDataProvider
* @expectedException \OCP\Files\InvalidPathException * @expectedException \OCP\Files\InvalidPathException
*/ */
public function testTooLongPath($operation, $param0 = NULL) { public function testTooLongPath($operation, $param0 = null) {
$longPath = ''; $longPath = '';
// 4000 is the maximum path length in file_cache.path // 4000 is the maximum path length in file_cache.path
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment