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 16:06:26 +0200 |
commit | bc6e352ccd41f0641144fc1fc2d4e52e8f5532c0 (patch) | |
tree | 8cf140e04be65bb5f8dee5b81e608f578628b3ba /tests | |
parent | 666e52a46b971d49eb43024afe87cabf42b6f49b (diff) | |
download | nextcloud-server-bc6e352ccd41f0641144fc1fc2d4e52e8f5532c0.tar.gz nextcloud-server-bc6e352ccd41f0641144fc1fc2d4e52e8f5532c0.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()
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 a5107c351f4..205afba707b 100644 --- a/tests/lib/files/view.php +++ b/tests/lib/files/view.php @@ -416,4 +416,38 @@ class View extends \PHPUnit_Framework_TestCase { $view->file_put_contents('/asd.txt', 'foo'); $this->assertNull($this->createHookPath); } + + /** + * @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('', '/'), + ); + } } |