mirror of
https://github.com/composer/composer
synced 2025-05-09 08:32:56 +00:00
Remove RepositorySet from Solver and remove getPool from RepositorySet
This commit is contained in:
parent
f982a10447
commit
c41df325d8
10 changed files with 36 additions and 61 deletions
|
@ -144,9 +144,6 @@ class RuleSetTest extends TestCase
|
|||
));
|
||||
|
||||
$repositorySetMock = $this->getMockBuilder('Composer\Repository\RepositorySet')->disableOriginalConstructor()->getMock();
|
||||
$repositorySetMock->expects($this->any())
|
||||
->method('getPool')
|
||||
->willReturn($pool);
|
||||
$requestMock = $this->getMockBuilder('Composer\DependencyResolver\Request')->disableOriginalConstructor()->getMock();
|
||||
|
||||
$ruleSet = new RuleSet;
|
||||
|
@ -155,6 +152,6 @@ class RuleSetTest extends TestCase
|
|||
|
||||
$ruleSet->add($rule, RuleSet::TYPE_REQUEST);
|
||||
|
||||
$this->assertContains('REQUEST : No package found to satisfy root composer.json require foo/bar', $ruleSet->getPrettyString($repositorySetMock, $requestMock));
|
||||
$this->assertContains('REQUEST : No package found to satisfy root composer.json require foo/bar', $ruleSet->getPrettyString($repositorySetMock, $requestMock, $pool));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,13 +100,10 @@ class RuleTest extends TestCase
|
|||
));
|
||||
|
||||
$repositorySetMock = $this->getMockBuilder('Composer\Repository\RepositorySet')->disableOriginalConstructor()->getMock();
|
||||
$repositorySetMock->expects($this->any())
|
||||
->method('getPool')
|
||||
->willReturn($pool);
|
||||
$requestMock = $this->getMockBuilder('Composer\DependencyResolver\Request')->disableOriginalConstructor()->getMock();
|
||||
|
||||
$rule = new GenericRule(array($p1->getId(), -$p2->getId()), Rule::RULE_PACKAGE_REQUIRES, new Link('baz', 'foo'));
|
||||
|
||||
$this->assertEquals('baz 1.1 relates to foo -> satisfiable by foo[2.1].', $rule->getPrettyString($repositorySetMock, $requestMock));
|
||||
$this->assertEquals('baz 1.1 relates to foo -> satisfiable by foo[2.1].', $rule->getPrettyString($repositorySetMock, $requestMock, $pool));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ class SolverTest extends TestCase
|
|||
protected $request;
|
||||
protected $policy;
|
||||
protected $solver;
|
||||
protected $pool;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
|
@ -82,7 +83,7 @@ class SolverTest extends TestCase
|
|||
$problems = $e->getProblems();
|
||||
$this->assertCount(1, $problems);
|
||||
$this->assertEquals(2, $e->getCode());
|
||||
$this->assertEquals("\n - Root composer.json requires b, it could not be found in any version, there may be a typo in the package name.", $problems[0]->getPrettyString($this->repoSet, $this->request));
|
||||
$this->assertEquals("\n - Root composer.json requires b, it could not be found in any version, there may be a typo in the package name.", $problems[0]->getPrettyString($this->repoSet, $this->request, $this->pool));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -653,7 +654,7 @@ class SolverTest extends TestCase
|
|||
$msg .= " - Root composer.json requires a -> satisfiable by A[1.0].\n";
|
||||
$msg .= " - B 1.0 conflicts with A[1.0].\n";
|
||||
$msg .= " - Root composer.json requires b -> satisfiable by B[1.0].\n";
|
||||
$this->assertEquals($msg, $e->getMessage());
|
||||
$this->assertEquals($msg, $e->getPrettyString($this->repoSet, $this->request, $this->pool));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -683,7 +684,7 @@ class SolverTest extends TestCase
|
|||
$msg .= " Problem 1\n";
|
||||
$msg .= " - Root composer.json requires a -> satisfiable by A[1.0].\n";
|
||||
$msg .= " - A 1.0 requires b >= 2.0 -> found B[1.0] but it does not match your constraint.\n";
|
||||
$this->assertEquals($msg, $e->getMessage());
|
||||
$this->assertEquals($msg, $e->getPrettyString($this->repoSet, $this->request, $this->pool));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -728,7 +729,7 @@ class SolverTest extends TestCase
|
|||
$msg .= " - Only one of these can be installed: B[0.9, 1.0].\n";
|
||||
$msg .= " - A 1.0 requires b >= 1.0 -> satisfiable by B[1.0].\n";
|
||||
$msg .= " - Root composer.json requires a -> satisfiable by A[1.0].\n";
|
||||
$this->assertEquals($msg, $e->getMessage());
|
||||
$this->assertEquals($msg, $e->getPrettyString($this->repoSet, $this->request, $this->pool));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -889,7 +890,8 @@ class SolverTest extends TestCase
|
|||
|
||||
protected function createSolver()
|
||||
{
|
||||
$this->solver = new Solver($this->policy, $this->repoSet->createPool($this->request), new NullIO(), $this->repoSet);
|
||||
$this->pool = $this->repoSet->createPool($this->request);
|
||||
$this->solver = new Solver($this->policy, $this->pool, new NullIO());
|
||||
}
|
||||
|
||||
protected function checkSolverResult(array $expected)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue