commit
855b1cb9d3
|
@ -86,21 +86,13 @@ EOT
|
||||||
$request = new Request($pool);
|
$request = new Request($pool);
|
||||||
if ($update) {
|
if ($update) {
|
||||||
$output->writeln('<info>Updating dependencies.</info>');
|
$output->writeln('<info>Updating dependencies.</info>');
|
||||||
$listedPackages = array();
|
|
||||||
$installedPackages = $installedRepo->getPackages();
|
$installedPackages = $installedRepo->getPackages();
|
||||||
$links = $this->collectLinks($input, $composer->getPackage());
|
$links = $this->collectLinks($input, $composer->getPackage());
|
||||||
|
|
||||||
foreach ($links as $link) {
|
foreach ($links as $link) {
|
||||||
$listedPackages[] = $link->getTarget();
|
|
||||||
|
|
||||||
foreach ($installedPackages as $package) {
|
foreach ($installedPackages as $package) {
|
||||||
if ($package->getName() === $link->getTarget()) {
|
if ($package->getName() === $link->getTarget()) {
|
||||||
$constraint = new VersionConstraint('=', $package->getVersion());
|
$request->update($package->getName(), new VersionConstraint('=', $package->getVersion()));
|
||||||
if ($link->getConstraint()->matches($constraint)) {
|
|
||||||
continue 2;
|
|
||||||
}
|
|
||||||
// TODO this should just update to the exact version (once constraints are available on update, see #125)
|
|
||||||
$request->remove($package->getName(), $constraint);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,6 +139,40 @@ class SolverTest extends TestCase
|
||||||
$this->checkSolverResult(array());
|
$this->checkSolverResult(array());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testSolverUpdateConstrained()
|
||||||
|
{
|
||||||
|
$this->repoInstalled->addPackage($packageA = $this->getPackage('A', '1.0'));
|
||||||
|
$this->repo->addPackage($newPackageA = $this->getPackage('A', '1.2'));
|
||||||
|
$this->repo->addPackage($this->getPackage('A', '2.0'));
|
||||||
|
$this->reposComplete();
|
||||||
|
|
||||||
|
$this->request->install('A', new VersionConstraint('<', '2.0.0.0'));
|
||||||
|
$this->request->update('A');
|
||||||
|
|
||||||
|
$this->checkSolverResult(array(array(
|
||||||
|
'job' => 'update',
|
||||||
|
'from' => $packageA,
|
||||||
|
'to' => $newPackageA,
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSolverUpdateFullyConstrained()
|
||||||
|
{
|
||||||
|
$this->repoInstalled->addPackage($packageA = $this->getPackage('A', '1.0'));
|
||||||
|
$this->repo->addPackage($newPackageA = $this->getPackage('A', '1.2'));
|
||||||
|
$this->repo->addPackage($this->getPackage('A', '2.0'));
|
||||||
|
$this->reposComplete();
|
||||||
|
|
||||||
|
$this->request->install('A', new VersionConstraint('<', '2.0.0.0'));
|
||||||
|
$this->request->update('A', new VersionConstraint('=', '1.0.0.0'));
|
||||||
|
|
||||||
|
$this->checkSolverResult(array(array(
|
||||||
|
'job' => 'update',
|
||||||
|
'from' => $packageA,
|
||||||
|
'to' => $newPackageA,
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
|
||||||
public function testSolverAllJobs()
|
public function testSolverAllJobs()
|
||||||
{
|
{
|
||||||
$this->repoInstalled->addPackage($packageD = $this->getPackage('D', '1.0'));
|
$this->repoInstalled->addPackage($packageD = $this->getPackage('D', '1.0'));
|
||||||
|
|
Loading…
Reference in New Issue