summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-05-13 14:17:51 +0200
committerVincent Petry <pvince81@owncloud.com>2014-05-13 17:38:46 +0200
commitbab8c1f8e51a93443c29fdabfdc9951d0efde473 (patch)
treea63f05e14610b8d2a37ed12c14f91cf4e7da821b /tests
parent6d00675d694c0d8ec7bf451ae5eb938ac6ff363c (diff)
downloadnextcloud-server-bab8c1f8e51a93443c29fdabfdc9951d0efde473.tar.gz
nextcloud-server-bab8c1f8e51a93443c29fdabfdc9951d0efde473.zip
Fixed getAbsolutePath case when path is "0"
Make sure to correctly check for string emptiness when the passed path is "0".
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/files/view.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/lib/files/view.php b/tests/lib/files/view.php
index f80dd06e1cb..a51b15857d5 100644
--- a/tests/lib/files/view.php
+++ b/tests/lib/files/view.php
@@ -585,4 +585,22 @@ class View extends \PHPUnit_Framework_TestCase {
$info2 = $view->getFileInfo('/test/test');
$this->assertSame($info['etag'], $info2['etag']);
}
+
+ /**
+ * @dataProvider absolutePathProvider
+ */
+ public function testGetAbsolutePath($expectedPath, $relativePath) {
+ $view = new \OC\Files\View('/files');
+ $this->assertEquals($expectedPath, $view->getAbsolutePath($relativePath));
+ }
+
+ function absolutePathProvider() {
+ return array(
+ array('/files/', ''),
+ array('/files/0', '0'),
+ array('/files/', '/'),
+ array('/files/test', 'test'),
+ array('/files/test', '/test'),
+ );
+ }
}