diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2013-10-10 16:06:26 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2013-10-10 23:16:00 +0200 |
commit | f8d28138b2eead8e2b6e83c006ab1469c208970e (patch) | |
tree | 17a9236a1fb8b89d665f23dbacc872fe99bebe44 /tests | |
parent | edd8d22c6f64231f0fe8306d9c9840beea056a78 (diff) | |
download | nextcloud-server-f8d28138b2eead8e2b6e83c006ab1469c208970e.tar.gz nextcloud-server-f8d28138b2eead8e2b6e83c006ab1469c208970e.zip |
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.php | 34 |
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('', '/'), + ); + } } |