[Filesystem] Added unit tests for isAbsolutePath method.
This commit is contained in:
parent
2ee4b8861c
commit
8c940699c1
@ -411,7 +411,7 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideAbsolutePaths
|
||||
* @dataProvider providePathsForMakePathRelative
|
||||
*/
|
||||
public function testMakePathRelative($endPath, $startPath, $expectedPath)
|
||||
{
|
||||
@ -423,7 +423,7 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function provideAbsolutePaths()
|
||||
public function providePathsForMakePathRelative()
|
||||
{
|
||||
$paths = array(
|
||||
array('/var/lib/symfony/src/Symfony/', '/var/lib/symfony/src/Symfony/Component', '../'),
|
||||
@ -441,6 +441,30 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase
|
||||
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)
|
||||
*
|
||||
|
Reference in New Issue
Block a user