summaryrefslogtreecommitdiffstats
path: root/tests/lib/files/filesystem.php
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2014-11-17 16:57:15 +0100
committerJoas Schilling <nickvergessen@gmx.de>2014-11-17 16:59:11 +0100
commitccc100113803ec82fc2eab7c62620e2b3a4c7df6 (patch)
tree142789d54d1bad4cfa05691f8582d853d6e06c0a /tests/lib/files/filesystem.php
parent806284f06c9689449fc6b118bc9478843a9472ec (diff)
downloadnextcloud-server-ccc100113803ec82fc2eab7c62620e2b3a4c7df6.tar.gz
nextcloud-server-ccc100113803ec82fc2eab7c62620e2b3a4c7df6.zip
Add tests for absolute paths on windows
Diffstat (limited to 'tests/lib/files/filesystem.php')
-rw-r--r--tests/lib/files/filesystem.php34
1 files changed, 32 insertions, 2 deletions
diff --git a/tests/lib/files/filesystem.php b/tests/lib/files/filesystem.php
index 447c2717dbb..f24d86b212d 100644
--- a/tests/lib/files/filesystem.php
+++ b/tests/lib/files/filesystem.php
@@ -131,6 +131,14 @@ class Filesystem extends \Test\TestCase {
array('/foo/.bar/', '\\foo\\.bar\\', false),
array('/foo/.bar/tee', '\\foo\\.bar\\tee'),
+ // Absolute windows paths NOT marked as absolute
+ array('/C:', 'C:\\'),
+ array('/C:/', 'C:\\', false),
+ array('/C:/tests', 'C:\\tests'),
+ array('/C:/tests', 'C:\\tests', false),
+ array('/C:/tests', 'C:\\tests\\'),
+ array('/C:/tests/', 'C:\\tests\\', false),
+
// normalize does not resolve '..' (by design)
array('/foo/..', '/foo/../'),
array('/foo/..', '\\foo\\..\\'),
@@ -140,8 +148,30 @@ class Filesystem extends \Test\TestCase {
/**
* @dataProvider normalizePathData
*/
- public function testNormalizePath($expected, $path, $stripTrailingSlash = true, $isAbsolutePath = false) {
- $this->assertEquals($expected, \OC\Files\Filesystem::normalizePath($path, $stripTrailingSlash, $isAbsolutePath));
+ public function testNormalizePath($expected, $path, $stripTrailingSlash = true) {
+ $this->assertEquals($expected, \OC\Files\Filesystem::normalizePath($path, $stripTrailingSlash));
+ }
+
+ public function normalizePathWindowsAbsolutePathData() {
+ return array(
+ array('C:/', 'C:\\'),
+ array('C:/', 'C:\\', false),
+ array('C:/tests', 'C:\\tests'),
+ array('C:/tests', 'C:\\tests', false),
+ array('C:/tests', 'C:\\tests\\'),
+ array('C:/tests/', 'C:\\tests\\', false),
+ );
+ }
+
+ /**
+ * @dataProvider normalizePathWindowsAbsolutePathData
+ */
+ public function testNormalizePathWindowsAbsolutePath($expected, $path, $stripTrailingSlash = true) {
+ if (!\OC_Util::runningOnWindows()) {
+ $this->markTestSkipped('This test is Windows only');
+ }
+
+ $this->assertEquals($expected, \OC\Files\Filesystem::normalizePath($path, $stripTrailingSlash, true));
}
public function testNormalizePathUTF8() {