Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2013-10-10 18:06:26 +0400
committerThomas Müller <thomas.mueller@tmit.eu>2013-10-11 01:16:00 +0400
commitf8d28138b2eead8e2b6e83c006ab1469c208970e (patch)
tree17a9236a1fb8b89d665f23dbacc872fe99bebe44 /tests
parentedd8d22c6f64231f0fe8306d9c9840beea056a78 (diff)
the path need to be normalized before putting it into resolvePath()
otherwise the returned internalPath will not match followup calls to e.g. Cache::getID() Conflicts: tests/lib/files/view.php
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/files/view.php34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/lib/files/view.php b/tests/lib/files/view.php
index 1cd07773513..732f61dc5bd 100644
--- a/tests/lib/files/view.php
+++ b/tests/lib/files/view.php
@@ -282,4 +282,38 @@ class View extends \PHPUnit_Framework_TestCase {
$this->storages[] = $storage;
return $storage;
}
+
+ /**
+ * @dataProvider resolvePathTestProvider
+ */
+ public function testResolvePath($expected, $pathToTest) {
+ $storage1 = $this->getTestStorage();
+ \OC\Files\Filesystem::mount($storage1, array(), '/');
+
+ $view = new \OC\Files\View('');
+
+ $result = $view->resolvePath($pathToTest);
+ $this->assertEquals($expected, $result[1]);
+
+ $exists = $view->file_exists($pathToTest);
+ $this->assertTrue($exists);
+
+ $exists = $view->file_exists($result[1]);
+ $this->assertTrue($exists);
+ }
+
+ function resolvePathTestProvider() {
+ return array(
+ array('foo.txt', 'foo.txt'),
+ array('foo.txt', '/foo.txt'),
+ array('folder', 'folder'),
+ array('folder', '/folder'),
+ array('folder', 'folder/'),
+ array('folder', '/folder/'),
+ array('folder/bar.txt', 'folder/bar.txt'),
+ array('folder/bar.txt', '/folder/bar.txt'),
+ array('', ''),
+ array('', '/'),
+ );
+ }
}