1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-10 17:12:51 +00:00

Let the solver handle aliases instead of the installer

This commit is contained in:
Nils Adermann 2012-04-27 19:41:53 +02:00
parent d74eec9bd5
commit 0c1944a9d0
13 changed files with 382 additions and 109 deletions

View file

@ -670,6 +670,55 @@ class SolverTest extends TestCase
));
}
public function testInstallRecursiveAliasDependencies()
{
$this->repo->addPackage($packageA = $this->getPackage('A', '1.0'));
$this->repo->addPackage($packageB = $this->getPackage('B', '2.0'));
$this->repo->addPackage($packageA2 = $this->getPackage('A', '2.0'));
$packageA2->setRequires(array(
new Link('A', 'B', $this->getVersionConstraint('==', '2.0'), 'requires', '== 2.0'),
));
$packageB->setRequires(array(
new Link('B', 'A', $this->getVersionConstraint('>=', '2.0'), 'requires'),
));
$this->repo->addPackage($packageA2Alias = $this->getAliasPackage($packageA2, '1.1'));
$this->reposComplete();
$this->request->install('A', $this->getVersionConstraint('==', '1.1.0.0'));
$this->checkSolverResult(array(
array('job' => 'install', 'package' => $packageB),
array('job' => 'install', 'package' => $packageA2),
array('job' => 'install', 'package' => $packageA2Alias),
));
}
public function testInstallDevAlias()
{
$this->repo->addPackage($packageA = $this->getPackage('A', '2.0'));
$this->repo->addPackage($packageB = $this->getPackage('B', '1.0'));
$packageB->setRequires(array(
new Link('B', 'A', $this->getVersionConstraint('<', '2.0'), 'requires'),
));
$this->repo->addPackage($packageAAlias = $this->getAliasPackage($packageA, '1.1'));
$this->reposComplete();
$this->request->install('A', $this->getVersionConstraint('==', '2.0'));
$this->request->install('B');
$this->checkSolverResult(array(
array('job' => 'install', 'package' => $packageAAlias),
array('job' => 'install', 'package' => $packageB),
array('job' => 'install', 'package' => $packageA),
));
}
protected function reposComplete()
{
$this->pool->addRepository($this->repoInstalled);