8000 [Filesystem] Added unit tests for isAbsolutePath method. · symfony/symfony@8c94069 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8c94069

Browse files
committed
[Filesystem] Added unit tests for isAbsolutePath method.
1 parent 2ee4b88 commit 8c94069

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

src/Symfony/Component/Filesystem/Tests/FilesystemTest.php

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ public function testSymlinkIsNotOverwrittenIfAlreadyCreated()
411411
}
412412

413413
/**
414-
* @dataProvider provideAbsolutePaths
414+
* @dataProvider providePathsForMakePathRelative
415415
*/
416416
public function testMakePathRelative($endPath, $startPath, $expectedPath)
417417
{
@@ -423,7 +423,7 @@ public function testMakePathRelative($endPath, $startPath, $expectedPath)
423423
/**
424424
* @return array
425425
*/
426-
public function provideAbsolutePaths()
426+
public function providePathsForMakePathRelative()
427427
{
428428
$paths = array(
429429
array('/var/lib/symfony/src/Symfony/', '/var/lib/symfony/src/Symfony/Component', '../'),
@@ -441,6 +441,30 @@ public function provideAbsolutePaths()
441441
return $paths;
442442
}
443443

444+
/**
445+
* @dataProvider providePathsForIsAbsolutePath
446+
*/
447+
public function testIsAbsolutePath($path, $expectedResult)
448+
{
449+
$result = $this->filesystem->isAbsolutePath($path);
450+
451+
$this->assertEquals($expectedResult, $result);
452+
}
453+
454+
/**
455+
* @return array
456+
*/
457+
public function providePathsForIsAbsolutePath()
458+
{
459+
return array(
460+
array('/var/lib', true),
461+
array('c:\\\\var\\lib', true),
462+
array('\\var\\lib', true),
463+
array('var/lib', false),
464+
array('../var/lib', false)
465+
);
466+
}
467+
444468
/**
445469
* Returns file permissions as three digits (i.e. 755)
446470
*

0 commit comments

Comments
 (0)
0