1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-09 00:22:53 +00:00

Add a new RepositorySet class and restrict pool usage to the solver

Breaking change for the plugin interface so bumping the version of
composer-plugin-api to 2.0.0

First step for a refactoring of the package metadata loading mechanism
This commit is contained in:
Nils Adermann 2018-09-10 15:23:40 +02:00
parent 92dc2cd9ad
commit 6ef65e5319
24 changed files with 265 additions and 198 deletions

View file

@ -20,12 +20,13 @@ use Composer\DependencyResolver\Request;
use Composer\DependencyResolver\Solver;
use Composer\DependencyResolver\SolverProblemsException;
use Composer\Package\Link;
use Composer\Repository\RepositorySet;
use Composer\TestCase;
use Composer\Semver\Constraint\MultiConstraint;
class SolverTest extends TestCase
{
protected $pool;
protected $repoSet;
protected $repo;
protected $repoInstalled;
protected $request;
@ -33,13 +34,13 @@ class SolverTest extends TestCase
public function setUp()
{
$this->pool = new Pool;
$this->repoSet = new RepositorySet(new Pool);
$this->repo = new ArrayRepository;
$this->repoInstalled = new ArrayRepository;
$this->request = new Request($this->pool);
$this->request = new Request($this->repoSet);
$this->policy = new DefaultPolicy;
$this->solver = new Solver($this->policy, $this->pool, $this->repoInstalled, new NullIO());
$this->solver = new Solver($this->policy, $this->repoSet, $this->repoInstalled, new NullIO());
}
public function testSolverInstallSingle()
@ -90,9 +91,9 @@ class SolverTest extends TestCase
$repo1->addPackage($foo1 = $this->getPackage('foo', '1'));
$repo2->addPackage($foo2 = $this->getPackage('foo', '1'));
$this->pool->addRepository($this->repoInstalled);
$this->pool->addRepository($repo1);
$this->pool->addRepository($repo2);
$this->repoSet->addRepository($this->repoInstalled);
$this->repoSet->addRepository($repo1);
$this->repoSet->addRepository($repo2);
$this->request->install('foo');
@ -839,8 +840,8 @@ class SolverTest extends TestCase
protected function reposComplete()
{
$this->pool->addRepository($this->repoInstalled);
$this->pool->addRepository($this->repo);
$this->repoSet->addRepository($this->repoInstalled);
$this->repoSet->addRepository($this->repo);
}
protected function checkSolverResult(array $expected)