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:
authorBjoern Schiessle <schiessle@owncloud.com>2015-02-04 14:07:16 +0300
committerBjoern Schiessle <schiessle@owncloud.com>2015-02-04 14:47:04 +0300
commit21c45925fe11cac27cf61958a0c0863313afbdb2 (patch)
tree848c32c01e6ffc246348e2572ff645c5bc7c201a /tests
parent9e222ec841946d773514f790fcc567c634d27038 (diff)
detect root of mountpoint also if the trailing slash is missed
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/files/view.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/lib/files/view.php b/tests/lib/files/view.php
index 9ddc9c80475..f6af59d52be 100644
--- a/tests/lib/files/view.php
+++ b/tests/lib/files/view.php
@@ -729,6 +729,28 @@ class View extends \Test\TestCase {
);
}
+ /**
+ * @dataProvider relativePathProvider
+ */
+ function testGetRelativePath($absolutePath, $expectedPath) {
+ $view = new \OC\Files\View('/files');
+ // simulate a external storage mount point which has a trailing slash
+ $view->chroot('/files/');
+ $this->assertEquals($expectedPath, $view->getRelativePath($absolutePath));
+ }
+
+ function relativePathProvider() {
+ return array(
+ array('/files/', '/'),
+ array('/files', '/'),
+ array('/files/0', '0'),
+ array('/files/false', 'false'),
+ array('/files/true', 'true'),
+ array('/files/test', 'test'),
+ array('/files/test/foo', 'test/foo'),
+ );
+ }
+
public function testFileView() {
$storage = new Temporary(array());
$scanner = $storage->getScanner();