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

Move construction of pool from repo set into a pool builder

Pool construction depends on the install request now, so only required
packages get loaded, add some structure for future asynchronously
loading composer repositories
This commit is contained in:
Nils Adermann 2018-09-12 11:49:09 +02:00
parent 4c7d271a36
commit c0f19f6c57
20 changed files with 357 additions and 248 deletions

View file

@ -22,13 +22,6 @@ use Composer\TestCase;
class RuleTest extends TestCase
{
protected $pool;
public function setUp()
{
$this->pool = new Pool(array('stable' => BasePackage::STABILITY_STABLE));
}
public function testGetHash()
{
$rule = new GenericRule(array(123), Rule::RULE_JOB_INSTALL, null);
@ -100,13 +93,16 @@ class RuleTest extends TestCase
public function testPrettyString()
{
$repo = new ArrayRepository;
$repo->addPackage($p1 = $this->getPackage('foo', '2.1'));
$repo->addPackage($p2 = $this->getPackage('baz', '1.1'));
$this->pool->addRepository($repo);
$pool = new Pool(array('stable' => BasePackage::STABILITY_STABLE));
$pool->setPackages(array(
$p1 = $this->getPackage('foo', '2.1'),
$p2 = $this->getPackage('baz', '1.1'),
));
$p1->setId(1);
$p2->setId(2);
$rule = new GenericRule(array($p1->getId(), -$p2->getId()), Rule::RULE_JOB_INSTALL, null);
$this->assertEquals('Install command rule (don\'t install baz 1.1|install foo 2.1)', $rule->getPrettyString($this->pool));
$this->assertEquals('Install command rule (don\'t install baz 1.1|install foo 2.1)', $rule->getPrettyString($pool));
}
}