diff options
author | VicDeo <dubiniuk@owncloud.com> | 2013-10-10 09:27:45 -0700 |
---|---|---|
committer | VicDeo <dubiniuk@owncloud.com> | 2013-10-10 09:27:45 -0700 |
commit | 26c0007a5ff65a718abce63939b65de0cda9c7a1 (patch) | |
tree | 748b886efd52f08cfe7557b9fee3c66d8f5115ed /tests | |
parent | 0641365a1033b3e6b926a5e280f3bd2559e2ea23 (diff) | |
parent | bc6e352ccd41f0641144fc1fc2d4e52e8f5532c0 (diff) | |
download | nextcloud-server-26c0007a5ff65a718abce63939b65de0cda9c7a1.tar.gz nextcloud-server-26c0007a5ff65a718abce63939b65de0cda9c7a1.zip |
Merge pull request #5263 from owncloud/fixing-5255-master
Proper behavior of resolvePath()
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 b2dd3963f1c..0cc86d6651a 100644 --- a/tests/lib/files/view.php +++ b/tests/lib/files/view.php @@ -434,4 +434,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('', '/'), + ); + } } |