mirror of
https://github.com/nextcloud/server.git
synced 2026-04-15 22:11:17 -04:00
Add tests for absolute paths on windows
This commit is contained in:
parent
806284f06c
commit
ccc1001138
1 changed files with 32 additions and 2 deletions
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue