Fix regression in 036fc44c25
, fixes #7268
parent
69d25c090e
commit
43e33be79f
|
@ -17,6 +17,7 @@ use Composer\DependencyResolver\DefaultPolicy;
|
||||||
use Composer\DependencyResolver\Operation\UpdateOperation;
|
use Composer\DependencyResolver\Operation\UpdateOperation;
|
||||||
use Composer\DependencyResolver\Operation\InstallOperation;
|
use Composer\DependencyResolver\Operation\InstallOperation;
|
||||||
use Composer\DependencyResolver\Operation\UninstallOperation;
|
use Composer\DependencyResolver\Operation\UninstallOperation;
|
||||||
|
use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation;
|
||||||
use Composer\DependencyResolver\Operation\OperationInterface;
|
use Composer\DependencyResolver\Operation\OperationInterface;
|
||||||
use Composer\DependencyResolver\PolicyInterface;
|
use Composer\DependencyResolver\PolicyInterface;
|
||||||
use Composer\DependencyResolver\Pool;
|
use Composer\DependencyResolver\Pool;
|
||||||
|
@ -716,6 +717,10 @@ class Installer
|
||||||
foreach ($devPackages as $pkg) {
|
foreach ($devPackages as $pkg) {
|
||||||
$packagesToSkip[$pkg->getName()] = true;
|
$packagesToSkip[$pkg->getName()] = true;
|
||||||
if ($installedDevPkg = $localRepo->findPackage($pkg->getName(), '*')) {
|
if ($installedDevPkg = $localRepo->findPackage($pkg->getName(), '*')) {
|
||||||
|
if ($installedDevPkg instanceof AliasPackage) {
|
||||||
|
$finalOps[] = new MarkAliasUninstalledOperation($installedDevPkg, 'non-dev install removing it');
|
||||||
|
$installedDevPkg = $installedDevPkg->getAliasOf();
|
||||||
|
}
|
||||||
$finalOps[] = new UninstallOperation($installedDevPkg, 'non-dev install removing it');
|
$finalOps[] = new UninstallOperation($installedDevPkg, 'non-dev install removing it');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,13 +167,6 @@ class ArrayRepository extends BaseRepository
|
||||||
{
|
{
|
||||||
$packageId = $package->getUniqueName();
|
$packageId = $package->getUniqueName();
|
||||||
|
|
||||||
if ($package instanceof AliasPackage) {
|
|
||||||
$aliasedPackage = $package->getAliasOf();
|
|
||||||
if ($this === $aliasedPackage->getRepository()) {
|
|
||||||
$this->removePackage($aliasedPackage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($this->getPackages() as $key => $repoPackage) {
|
foreach ($this->getPackages() as $key => $repoPackage) {
|
||||||
if ($packageId === $repoPackage->getUniqueName()) {
|
if ($packageId === $repoPackage->getUniqueName()) {
|
||||||
array_splice($this->packages, $key, 1);
|
array_splice($this->packages, $key, 1);
|
||||||
|
|
|
@ -68,7 +68,7 @@ class ArrayRepositoryTest extends TestCase
|
||||||
$this->assertEquals('bar', $bar[0]->getName());
|
$this->assertEquals('bar', $bar[0]->getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAutomaticallyAddAndRemoveAliasedPackage()
|
public function testAutomaticallyAddAliasedPackageButNotRemove()
|
||||||
{
|
{
|
||||||
$repo = new ArrayRepository();
|
$repo = new ArrayRepository();
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ class ArrayRepositoryTest extends TestCase
|
||||||
|
|
||||||
$repo->removePackage($alias);
|
$repo->removePackage($alias);
|
||||||
|
|
||||||
$this->assertCount(0, $repo);
|
$this->assertCount(1, $repo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSearch()
|
public function testSearch()
|
||||||
|
|
Loading…
Reference in New Issue