Merge remote-tracking branch 'webfactory/issue-2698'
Conflicts: src/Composer/Repository/ArtifactRepository.phppull/3137/head
commit
7b4fcd93d3
|
@ -139,7 +139,7 @@ class ArtifactRepository extends ArrayRepository
|
||||||
$package = JsonFile::parseJson($json, $composerFile);
|
$package = JsonFile::parseJson($json, $composerFile);
|
||||||
$package['dist'] = array(
|
$package['dist'] = array(
|
||||||
'type' => 'zip',
|
'type' => 'zip',
|
||||||
'url' => $file->getRealPath(),
|
'url' => $file->getPathname(),
|
||||||
'shasum' => sha1_file($file->getRealPath())
|
'shasum' => sha1_file($file->getRealPath())
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ use Composer\TestCase;
|
||||||
use Composer\IO\NullIO;
|
use Composer\IO\NullIO;
|
||||||
use Composer\Config;
|
use Composer\Config;
|
||||||
use Composer\Package\BasePackage;
|
use Composer\Package\BasePackage;
|
||||||
|
use Composer\Util\Filesystem;
|
||||||
|
|
||||||
class ArtifactRepositoryTest extends TestCase
|
class ArtifactRepositoryTest extends TestCase
|
||||||
{
|
{
|
||||||
|
@ -44,6 +45,29 @@ class ArtifactRepositoryTest extends TestCase
|
||||||
|
|
||||||
$this->assertSame($expectedPackages, $foundPackages);
|
$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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Files jsonInFirstLevel.zip, jsonInRoot.zip and jsonInSecondLevel.zip were generated with:
|
//Files jsonInFirstLevel.zip, jsonInRoot.zip and jsonInSecondLevel.zip were generated with:
|
||||||
|
|
Loading…
Reference in New Issue