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

This should create relative/absolute dist URLs depending on the way (relative/absolute) the artifact directory path was given.

This commit is contained in:
Matthias Pigulla 2014-02-18 23:28:45 +01:00
parent 9896abeb38
commit beff1f5cc1
2 changed files with 25 additions and 1 deletions

View file

@ -16,6 +16,7 @@ use Composer\TestCase;
use Composer\IO\NullIO;
use Composer\Config;
use Composer\Package\BasePackage;
use Composer\Util\Filesystem;
class ArtifactRepositoryTest extends TestCase
{
@ -40,4 +41,27 @@ class ArtifactRepositoryTest extends TestCase
$this->assertSame($expectedPackages, $foundPackages);
}
public function testAbsoluteRepoUrlCreatesAbsoluteUrlPackages()
{
$absolutePath = __DIR__ . '/Fixtures/artifacts';
$coordinates = array('type' => 'artifact', 'url' => $absolutePath);
$repo = new ArtifactRepository($coordinates, new NullIO(), new Config());
foreach ($repo->getPackages() as $package) {
$this->assertTrue(strpos($package->getDistUrl(), $absolutePath) === 0);
}
}
public function testRelativeRepoUrlCreatesRelativeUrlPackages()
{
$relativePath = 'tests/Composer/Test/Repository/Fixtures/artifacts';
$coordinates = array('type' => 'artifact', 'url' => $relativePath);
$repo = new ArtifactRepository($coordinates, new NullIO(), new Config());
foreach ($repo->getPackages() as $package) {
$this->assertTrue(strpos($package->getDistUrl(), $relativePath) === 0);
}
}
}