Add filesystem tests for the static shortest path, refs #5174
parent
1dc65a40d3
commit
4f0f8779cb
|
@ -32,15 +32,6 @@ class FilesystemTest extends TestCase
|
||||||
*/
|
*/
|
||||||
private $testFile;
|
private $testFile;
|
||||||
|
|
||||||
/**
|
|
||||||
* @dataProvider providePathCouplesAsCode
|
|
||||||
*/
|
|
||||||
public function testFindShortestPathCode($a, $b, $directory, $expected)
|
|
||||||
{
|
|
||||||
$fs = new Filesystem;
|
|
||||||
$this->assertEquals($expected, $fs->findShortestPathCode($a, $b, $directory));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
$this->fs = new Filesystem;
|
$this->fs = new Filesystem;
|
||||||
|
@ -58,6 +49,15 @@ class FilesystemTest extends TestCase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider providePathCouplesAsCode
|
||||||
|
*/
|
||||||
|
public function testFindShortestPathCode($a, $b, $directory, $expected, $static = false)
|
||||||
|
{
|
||||||
|
$fs = new Filesystem;
|
||||||
|
$this->assertEquals($expected, $fs->findShortestPathCode($a, $b, $directory, $static));
|
||||||
|
}
|
||||||
|
|
||||||
public function providePathCouplesAsCode()
|
public function providePathCouplesAsCode()
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
|
@ -94,6 +94,16 @@ class FilesystemTest extends TestCase
|
||||||
array('/foo/bar_vendor', '/foo/bar', true, "dirname(__DIR__).'/bar'"),
|
array('/foo/bar_vendor', '/foo/bar', true, "dirname(__DIR__).'/bar'"),
|
||||||
array('/foo/bar_vendor', '/foo/bar/src', true, "dirname(__DIR__).'/bar/src'"),
|
array('/foo/bar_vendor', '/foo/bar/src', true, "dirname(__DIR__).'/bar/src'"),
|
||||||
array('/foo/bar_vendor/src2', '/foo/bar/src/lib', true, "dirname(dirname(__DIR__)).'/bar/src/lib'"),
|
array('/foo/bar_vendor/src2', '/foo/bar/src/lib', true, "dirname(dirname(__DIR__)).'/bar/src/lib'"),
|
||||||
|
|
||||||
|
// static use case
|
||||||
|
array('/tmp/test/../vendor', '/tmp/test', true, "__DIR__ . '/..'.'/test'", true),
|
||||||
|
array('/tmp/test/.././vendor', '/tmp/test', true, "__DIR__ . '/..'.'/test'", true),
|
||||||
|
array('C:/Temp', 'c:\Temp\..\..\test', true, "__DIR__ . '/..'.'/test'", true),
|
||||||
|
array('C:/Temp/../..', 'd:\Temp\..\..\test', true, "'d:/test'", true),
|
||||||
|
array('/foo/bar', '/foo/bar_vendor', true, "__DIR__ . '/..'.'/bar_vendor'", true),
|
||||||
|
array('/foo/bar_vendor', '/foo/bar', true, "__DIR__ . '/..'.'/bar'", true),
|
||||||
|
array('/foo/bar_vendor', '/foo/bar/src', true, "__DIR__ . '/..'.'/bar/src'", true),
|
||||||
|
array('/foo/bar_vendor/src2', '/foo/bar/src/lib', true, "__DIR__ . '/../..'.'/bar/src/lib'", true),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue