1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-09 00:22:53 +00:00

Add proxy files for windows instead of copying, removed PEAR-style substitution

This commit is contained in:
Jordi Boggiano 2011-12-03 20:44:00 +01:00
parent aa94918d50
commit 7e3f8099b1
4 changed files with 200 additions and 29 deletions

View file

@ -0,0 +1,67 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Test\Repository;
use Composer\Downloader\Util\Filesystem;
use Composer\Test\TestCase;
class FilesystemTest extends TestCase
{
/**
* @dataProvider providePathCouplesAsCode
*/
public function testFindShortestPathCode($a, $b, $expected)
{
$fs = new Filesystem;
$this->assertEquals($expected, $fs->findShortestPathCode($a, $b));
}
public function providePathCouplesAsCode()
{
return array(
array('/foo/bar', '/foo/bar', "__FILE__"),
array('/foo/bar', '/foo/baz', "__DIR__.'/baz'"),
array('/foo/bin/run', '/foo/vendor/acme/bin/run', "dirname(__DIR__).'/vendor/acme/bin/run'"),
array('/foo/bin/run', '/foo/vendor/acme/bin/run', "dirname(__DIR__).'/vendor/acme/bin/run'"),
array('/foo/bin/run', '/bar/bin/run', "'/bar/bin/run'"),
array('c:/bin/run', 'c:/vendor/acme/bin/run', "dirname(__DIR__).'/vendor/acme/bin/run'"),
array('c:\\bin\\run', 'c:/vendor/acme/bin/run', "dirname(__DIR__).'/vendor/acme/bin/run'"),
array('c:/bin/run', 'd:/vendor/acme/bin/run', "'d:/vendor/acme/bin/run'"),
array('c:\\bin\\run', 'd:/vendor/acme/bin/run', "'d:/vendor/acme/bin/run'"),
);
}
/**
* @dataProvider providePathCouples
*/
public function testFindShortestPath($a, $b, $expected)
{
$fs = new Filesystem;
$this->assertEquals($expected, $fs->findShortestPath($a, $b));
}
public function providePathCouples()
{
return array(
array('/foo/bar', '/foo/bar', "./bar"),
array('/foo/bar', '/foo/baz', "./baz"),
array('/foo/bin/run', '/foo/vendor/acme/bin/run', "../vendor/acme/bin/run"),
array('/foo/bin/run', '/foo/vendor/acme/bin/run', "../vendor/acme/bin/run"),
array('/foo/bin/run', '/bar/bin/run', "/bar/bin/run"),
array('c:/bin/run', 'c:/vendor/acme/bin/run', "../vendor/acme/bin/run"),
array('c:\\bin\\run', 'c:/vendor/acme/bin/run', "../vendor/acme/bin/run"),
array('c:/bin/run', 'd:/vendor/acme/bin/run', "d:/vendor/acme/bin/run"),
array('c:\\bin\\run', 'd:/vendor/acme/bin/run', "d:/vendor/acme/bin/run"),
);
}
}