mirror of
https://github.com/composer/composer
synced 2025-05-09 00:22:53 +00:00
Make sure the root aliases always get installed when a package is updated, fixes #9448
This commit is contained in:
parent
8936f724d4
commit
7b183956d8
8 changed files with 207 additions and 6 deletions
|
@ -789,7 +789,7 @@ class SolverTest extends TestCase
|
|||
$this->checkSolverResult(array(
|
||||
array('job' => 'install', 'package' => $packageB),
|
||||
array('job' => 'install', 'package' => $packageA2),
|
||||
array('job' => 'install', 'package' => $packageA2Alias),
|
||||
array('job' => 'markAliasInstalled', 'package' => $packageA2Alias),
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -811,11 +811,40 @@ class SolverTest extends TestCase
|
|||
|
||||
$this->checkSolverResult(array(
|
||||
array('job' => 'install', 'package' => $packageA),
|
||||
array('job' => 'install', 'package' => $packageAAlias),
|
||||
array('job' => 'markAliasInstalled', 'package' => $packageAAlias),
|
||||
array('job' => 'install', 'package' => $packageB),
|
||||
));
|
||||
}
|
||||
|
||||
public function testInstallRootAliasesIfAliasOfIsInstalled()
|
||||
{
|
||||
// root aliased, required
|
||||
$this->repo->addPackage($packageA = $this->getPackage('A', '1.0'));
|
||||
$this->repo->addPackage($packageAAlias = $this->getAliasPackage($packageA, '1.1'));
|
||||
$packageAAlias->setRootPackageAlias(true);
|
||||
// root aliased, not required, should still be installed as it is root alias
|
||||
$this->repo->addPackage($packageB = $this->getPackage('B', '1.0'));
|
||||
$this->repo->addPackage($packageBAlias = $this->getAliasPackage($packageB, '1.1'));
|
||||
$packageBAlias->setRootPackageAlias(true);
|
||||
// regular alias, not required, alias should not be installed
|
||||
$this->repo->addPackage($packageC = $this->getPackage('C', '1.0'));
|
||||
$this->repo->addPackage($packageCAlias = $this->getAliasPackage($packageC, '1.1'));
|
||||
|
||||
$this->reposComplete();
|
||||
|
||||
$this->request->requireName('A', $this->getVersionConstraint('==', '1.1'));
|
||||
$this->request->requireName('B', $this->getVersionConstraint('==', '1.0'));
|
||||
$this->request->requireName('C', $this->getVersionConstraint('==', '1.0'));
|
||||
|
||||
$this->checkSolverResult(array(
|
||||
array('job' => 'install', 'package' => $packageA),
|
||||
array('job' => 'markAliasInstalled', 'package' => $packageAAlias),
|
||||
array('job' => 'install', 'package' => $packageB),
|
||||
array('job' => 'markAliasInstalled', 'package' => $packageBAlias),
|
||||
array('job' => 'install', 'package' => $packageC),
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests for a bug introduced in commit 451bab1c2cd58e05af6e21639b829408ad023463 Solver.php line 554/523
|
||||
*
|
||||
|
@ -915,6 +944,11 @@ class SolverTest extends TestCase
|
|||
'from' => $operation->getInitialPackage(),
|
||||
'to' => $operation->getTargetPackage(),
|
||||
);
|
||||
} elseif (in_array($operation->getOperationType(), array('markAliasInstalled', 'markAliasUninstalled'))) {
|
||||
$result[] = array(
|
||||
'job' => $operation->getOperationType(),
|
||||
'package' => $operation->getPackage(),
|
||||
);
|
||||
} else {
|
||||
$job = ('uninstall' === $operation->getOperationType() ? 'remove' : 'install');
|
||||
$result[] = array(
|
||||
|
@ -924,6 +958,16 @@ class SolverTest extends TestCase
|
|||
}
|
||||
}
|
||||
|
||||
$expectedReadable = array();
|
||||
foreach ($expected as $op) {
|
||||
$expectedReadable[] = array_map('strval', $op);
|
||||
}
|
||||
$resultReadable = array();
|
||||
foreach ($result as $op) {
|
||||
$resultReadable[] = array_map('strval', $op);
|
||||
}
|
||||
|
||||
$this->assertEquals($expectedReadable, $resultReadable);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue