1
0
Fork 0

Test case to verify relative paths remain relative

pull/4444/head
Dennis Birkholz 2015-09-23 18:15:43 +02:00
parent 9febf55f76
commit 3febbc2cbf
1 changed files with 25 additions and 0 deletions

View File

@ -81,4 +81,29 @@ class PathRepositoryTest extends TestCase
$package = $packages[1];
$this->assertEquals('test/path-unversioned', $package->getName());
}
/**
* Verify relative repository URLs remain relative, see #4439
*/
public function testUrlRemainsRelative()
{
$ioInterface = $this->getMockBuilder('Composer\IO\IOInterface')
->getMock();
$config = new \Composer\Config();
$loader = new ArrayLoader(new VersionParser());
$versionGuesser = null;
$repositoryUrl = implode(DIRECTORY_SEPARATOR, array(__DIR__, 'Fixtures', 'path', 'with-version'));
$relativeUrl = ltrim(substr($repositoryUrl, strlen(getcwd())), DIRECTORY_SEPARATOR);
$repository = new PathRepository(array('url' => $relativeUrl), $ioInterface, $config, $loader);
$packages = $repository->getPackages();
$this->assertEquals(1, $repository->count());
$package = $packages[0];
$this->assertEquals('test/path-versioned', $package->getName());
$this->assertEquals(rtrim($relativeUrl, DIRECTORY_SEPARATOR), rtrim($package->getDistUrl(), DIRECTORY_SEPARATOR));
}
}