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:
authorThomas Müller <thomas.mueller@tmit.eu>2013-11-14 23:40:21 +0400
committerThomas Müller <thomas.mueller@tmit.eu>2013-11-14 23:40:21 +0400
commit2bb4c266a6a3d2febe119054675f7d5ee8a9f46f (patch)
tree383f811eee1dcdf78ebc10fe853796fe91f34766 /tests
parent447e468d1ad5fbfe447d4b7446d6babba6802bbf (diff)
parentd9ab964ff980d495c8960a728fb082f006b6a1e6 (diff)
Merge pull request #5862 from owncloud/files-singledotdirs
Files singledotdirs
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/files/filesystem.php57
1 files changed, 56 insertions, 1 deletions
diff --git a/tests/lib/files/filesystem.php b/tests/lib/files/filesystem.php
index 990e95ca595..7cb57bf95ad 100644
--- a/tests/lib/files/filesystem.php
+++ b/tests/lib/files/filesystem.php
@@ -69,17 +69,72 @@ class Filesystem extends \PHPUnit_Framework_TestCase {
}
public function testNormalize() {
+ $this->assertEquals('/', \OC\Files\Filesystem::normalizePath(''));
+ $this->assertEquals('/', \OC\Files\Filesystem::normalizePath('/'));
+ $this->assertEquals('/', \OC\Files\Filesystem::normalizePath('/', false));
+ $this->assertEquals('/', \OC\Files\Filesystem::normalizePath('//'));
+ $this->assertEquals('/', \OC\Files\Filesystem::normalizePath('//', false));
$this->assertEquals('/path', \OC\Files\Filesystem::normalizePath('/path/'));
$this->assertEquals('/path/', \OC\Files\Filesystem::normalizePath('/path/', false));
$this->assertEquals('/path', \OC\Files\Filesystem::normalizePath('path'));
- $this->assertEquals('/path', \OC\Files\Filesystem::normalizePath('\path'));
$this->assertEquals('/foo/bar', \OC\Files\Filesystem::normalizePath('/foo//bar/'));
+ $this->assertEquals('/foo/bar/', \OC\Files\Filesystem::normalizePath('/foo//bar/', false));
$this->assertEquals('/foo/bar', \OC\Files\Filesystem::normalizePath('/foo////bar'));
+ $this->assertEquals('/foo/bar', \OC\Files\Filesystem::normalizePath('/foo/////bar'));
+ $this->assertEquals('/foo/bar', \OC\Files\Filesystem::normalizePath('/foo/bar/.'));
+ $this->assertEquals('/foo/bar', \OC\Files\Filesystem::normalizePath('/foo/bar/./'));
+ $this->assertEquals('/foo/bar/', \OC\Files\Filesystem::normalizePath('/foo/bar/./', false));
+ $this->assertEquals('/foo/bar', \OC\Files\Filesystem::normalizePath('/foo/bar/./.'));
+ $this->assertEquals('/foo/bar', \OC\Files\Filesystem::normalizePath('/foo/bar/././'));
+ $this->assertEquals('/foo/bar/', \OC\Files\Filesystem::normalizePath('/foo/bar/././', false));
+ $this->assertEquals('/foo/bar', \OC\Files\Filesystem::normalizePath('/foo/./bar/'));
+ $this->assertEquals('/foo/bar/', \OC\Files\Filesystem::normalizePath('/foo/./bar/', false));
+ $this->assertEquals('/foo/.bar', \OC\Files\Filesystem::normalizePath('/foo/.bar/'));
+ $this->assertEquals('/foo/.bar/', \OC\Files\Filesystem::normalizePath('/foo/.bar/', false));
+ $this->assertEquals('/foo/.bar/tee', \OC\Files\Filesystem::normalizePath('/foo/.bar/tee'));
+
+ // normalize does not resolve '..' (by design)
+ $this->assertEquals('/foo/..', \OC\Files\Filesystem::normalizePath('/foo/../'));
+
if (class_exists('Patchwork\PHP\Shim\Normalizer')) {
$this->assertEquals("/foo/bar\xC3\xBC", \OC\Files\Filesystem::normalizePath("/foo/baru\xCC\x88"));
}
}
+ public function testNormalizeWindowsPaths() {
+ $this->assertEquals('/', \OC\Files\Filesystem::normalizePath(''));
+ $this->assertEquals('/', \OC\Files\Filesystem::normalizePath('\\'));
+ $this->assertEquals('/', \OC\Files\Filesystem::normalizePath('\\', false));
+ $this->assertEquals('/', \OC\Files\Filesystem::normalizePath('\\\\'));
+ $this->assertEquals('/', \OC\Files\Filesystem::normalizePath('\\\\', false));
+ $this->assertEquals('/path', \OC\Files\Filesystem::normalizePath('\\path'));
+ $this->assertEquals('/path', \OC\Files\Filesystem::normalizePath('\\path', false));
+ $this->assertEquals('/path', \OC\Files\Filesystem::normalizePath('\\path\\'));
+ $this->assertEquals('/path/', \OC\Files\Filesystem::normalizePath('\\path\\', false));
+ $this->assertEquals('/foo/bar', \OC\Files\Filesystem::normalizePath('\\foo\\\\bar\\'));
+ $this->assertEquals('/foo/bar/', \OC\Files\Filesystem::normalizePath('\\foo\\\\bar\\', false));
+ $this->assertEquals('/foo/bar', \OC\Files\Filesystem::normalizePath('\\foo\\\\\\\\bar'));
+ $this->assertEquals('/foo/bar', \OC\Files\Filesystem::normalizePath('\\foo\\\\\\\\\\bar'));
+ $this->assertEquals('/foo/bar', \OC\Files\Filesystem::normalizePath('\\foo\\bar\\.'));
+ $this->assertEquals('/foo/bar', \OC\Files\Filesystem::normalizePath('\\foo\\bar\\.\\'));
+ $this->assertEquals('/foo/bar/', \OC\Files\Filesystem::normalizePath('\\foo\\bar\\.\\', false));
+ $this->assertEquals('/foo/bar', \OC\Files\Filesystem::normalizePath('\\foo\\bar\\.\\.'));
+ $this->assertEquals('/foo/bar', \OC\Files\Filesystem::normalizePath('\\foo\\bar\\.\\.\\'));
+ $this->assertEquals('/foo/bar/', \OC\Files\Filesystem::normalizePath('\\foo\\bar\\.\\.\\', false));
+ $this->assertEquals('/foo/bar', \OC\Files\Filesystem::normalizePath('\\foo\\.\\bar\\'));
+ $this->assertEquals('/foo/bar/', \OC\Files\Filesystem::normalizePath('\\foo\\.\\bar\\', false));
+ $this->assertEquals('/foo/.bar', \OC\Files\Filesystem::normalizePath('\\foo\\.bar\\'));
+ $this->assertEquals('/foo/.bar/', \OC\Files\Filesystem::normalizePath('\\foo\\.bar\\', false));
+ $this->assertEquals('/foo/.bar/tee', \OC\Files\Filesystem::normalizePath('\\foo\\.bar\\tee'));
+
+ // normalize does not resolve '..' (by design)
+ $this->assertEquals('/foo/..', \OC\Files\Filesystem::normalizePath('\\foo\\..\\'));
+
+ if (class_exists('Patchwork\PHP\Shim\Normalizer')) {
+ $this->assertEquals("/foo/bar\xC3\xBC", \OC\Files\Filesystem::normalizePath("\\foo\\baru\xCC\x88"));
+ }
+ }
+
public function testHooks() {
if(\OC\Files\Filesystem::getView()){
$user = \OC_User::getUser();