Skip to content

Commit

Permalink
[Filesystem] Added unit tests for isAbsolutePath method.
Browse files Browse the repository at this point in the history
  • Loading branch information
jakzal committed Apr 6, 2012
1 parent 2ee4b88 commit 8c94069
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions src/Symfony/Component/Filesystem/Tests/FilesystemTest.php
Expand Up @@ -411,7 +411,7 @@ public function testSymlinkIsNotOverwrittenIfAlreadyCreated()
}

/**
* @dataProvider provideAbsolutePaths
* @dataProvider providePathsForMakePathRelative
*/
public function testMakePathRelative($endPath, $startPath, $expectedPath)
{
Expand All @@ -423,7 +423,7 @@ public function testMakePathRelative($endPath, $startPath, $expectedPath)
/**
* @return array
*/
public function provideAbsolutePaths()
public function providePathsForMakePathRelative()
{
$paths = array(
array('/var/lib/symfony/src/Symfony/', '/var/lib/symfony/src/Symfony/Component', '../'),
Expand All @@ -441,6 +441,30 @@ public function provideAbsolutePaths()
return $paths;
}

/**
* @dataProvider providePathsForIsAbsolutePath
*/
public function testIsAbsolutePath($path, $expectedResult)
{
$result = $this->filesystem->isAbsolutePath($path);

$this->assertEquals($expectedResult, $result);
}

/**
* @return array
*/
public function providePathsForIsAbsolutePath()
{
return array(
array('/var/lib', true),
array('c:\\\\var\\lib', true),
array('\\var\\lib', true),
array('var/lib', false),
array('../var/lib', false)
);
}

/**
* Returns file permissions as three digits (i.e. 755)
*
Expand Down

0 comments on commit 8c94069

Please sign in to comment.