1
0
Fork 0

Correctly load aliases in lockedRepository to fix alias install output

pull/7936/head
Nils Adermann 2019-09-07 07:43:23 +02:00
parent 3e0e5dc1fa
commit a114e26841
2 changed files with 51 additions and 1 deletions

View File

@ -171,8 +171,19 @@ class Locker
}
if (isset($lockedPackages[0]['name'])) {
$packageByName = array();
foreach ($lockedPackages as $info) {
$packages->addPackage($this->loader->load($info));
$package = $this->loader->load($info);
$packages->addPackage($package);
$packageByName[$package->getName()] = $package;
}
if (isset($lockData['aliases'])) {
foreach ($lockData['aliases'] as $alias) {
if (isset($packageByName[$alias['package']])) {
$packages->addPackage(new AliasPackage($packageByName[$alias['package']], $alias['alias_normalized'], $alias['alias']));
}
}
}
return $packages;

View File

@ -43,6 +43,45 @@ Aliases take precedence over default package even if default is selected
},
"minimum-stability": "dev"
}
--EXPECT-LOCK--
{
"packages": [
{
"name": "a/a", "version": "dev-master",
"require": { "a/req": "dev-master" },
"type": "library"
},
{
"name": "a/b", "version": "dev-master",
"require": { "a/req": "dev-master" },
"type": "library"
},
{
"name": "a/req", "version": "dev-feature-foo",
"source": { "reference": "feat.f", "type": "git", "url": "" },
"type": "library"
}
],
"packages-dev": [],
"aliases": [
{
"alias": "dev-master",
"alias_normalized": "9999999-dev",
"version": "dev-feature-foo",
"package": "a/req"
}
],
"minimum-stability": "dev",
"stability-flags": {
"a/a": 20,
"a/b": 20,
"a/req": 20
},
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": []
}
--RUN--
install
--EXPECT--