1
0
Fork 0

Merge pull request #3984 from naderman/request-no-pool

[refactor] The Solver Request no longer depends on the Pool
pull/3130/merge
Jordi Boggiano 2015-04-30 16:48:05 +01:00
commit 013afdb233
3 changed files with 8 additions and 18 deletions

View File

@ -20,11 +20,9 @@ use Composer\Package\LinkConstraint\LinkConstraintInterface;
class Request
{
protected $jobs;
protected $pool;
public function __construct(Pool $pool)
public function __construct()
{
$this->pool = $pool;
$this->jobs = array();
}

View File

@ -287,7 +287,7 @@ class Installer
$pool->addRepository($installedRepo, $aliases);
// creating requirements request
$request = $this->createRequest($pool, $this->package, $platformRepo);
$request = $this->createRequest($this->package, $platformRepo);
$request->updateAll();
foreach ($this->package->getRequires() as $link) {
$request->install($link->getTarget(), $link->getConstraint());
@ -398,7 +398,7 @@ class Installer
}
// creating requirements request
$request = $this->createRequest($pool, $this->package, $platformRepo);
$request = $this->createRequest($this->package, $platformRepo);
if (!$installFromLock) {
// remove unstable packages from the localRepo if they don't match the current stability settings
@ -735,9 +735,9 @@ class Installer
return new DefaultPolicy($preferStable, $preferLowest);
}
private function createRequest(Pool $pool, RootPackageInterface $rootPackage, PlatformRepository $platformRepo)
private function createRequest(RootPackageInterface $rootPackage, PlatformRepository $platformRepo)
{
$request = new Request($pool);
$request = new Request();
$constraint = new VersionConstraint('=', $rootPackage->getVersion());
$constraint->setPrettyString($rootPackage->getPrettyVersion());

View File

@ -13,7 +13,6 @@
namespace Composer\Test\DependencyResolver;
use Composer\DependencyResolver\Request;
use Composer\DependencyResolver\Pool;
use Composer\Repository\ArrayRepository;
use Composer\TestCase;
@ -21,7 +20,6 @@ class RequestTest extends TestCase
{
public function testRequestInstallAndRemove()
{
$pool = new Pool;
$repo = new ArrayRepository;
$foo = $this->getPackage('foo', '1');
$bar = $this->getPackage('bar', '1');
@ -30,9 +28,8 @@ class RequestTest extends TestCase
$repo->addPackage($foo);
$repo->addPackage($bar);
$repo->addPackage($foobar);
$pool->addRepository($repo);
$request = new Request($pool);
$request = new Request();
$request->install('foo');
$request->fix('bar');
$request->remove('foobar');
@ -48,7 +45,6 @@ class RequestTest extends TestCase
public function testRequestInstallSamePackageFromDifferentRepositories()
{
$pool = new Pool;
$repo1 = new ArrayRepository;
$repo2 = new ArrayRepository;
@ -58,10 +54,7 @@ class RequestTest extends TestCase
$repo1->addPackage($foo1);
$repo2->addPackage($foo2);
$pool->addRepository($repo1);
$pool->addRepository($repo2);
$request = new Request($pool);
$request = new Request();
$request->install('foo', $constraint = $this->getVersionConstraint('=', '1'));
$this->assertEquals(
@ -74,8 +67,7 @@ class RequestTest extends TestCase
public function testUpdateAll()
{
$pool = new Pool;
$request = new Request($pool);
$request = new Request();
$request->updateAll();