1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-08 16:17:37 +00:00

Collect solver problems in Problem objects with human readable output.

This commit is contained in:
Nils Adermann 2012-03-18 20:41:10 +01:00
parent 2249dd0548
commit 2c87fe5a22
6 changed files with 230 additions and 86 deletions

View file

@ -59,13 +59,15 @@ class SolverTest extends TestCase
$this->repo->addPackage($this->getPackage('A', '1.0'));
$this->reposComplete();
$this->request->install('B');
$this->request->install('B', $this->getVersionConstraint('=', '1'));
try {
$transaction = $this->solver->solve($this->request);
$this->fail('Unsolvable conflict did not resolve in exception.');
$this->fail('Unsolvable conflict did not result in exception.');
} catch (SolverProblemsException $e) {
// TODO assert problem properties
$problems = $e->getProblems();
$this->assertEquals(1, count($problems));
$this->assertEquals('The requested package "b" with constraint == 1.0.0.0 could not be found.', (string) $problems[0]);
}
}
@ -589,8 +591,10 @@ class SolverTest extends TestCase
try {
$transaction = $this->solver->solve($this->request);
$this->fail('Unsolvable conflict did not resolve in exception.');
$this->fail('Unsolvable conflict did not result in exception.');
} catch (SolverProblemsException $e) {
$problems = $e->getProblems();
$this->assertEquals(1, count($problems));
// TODO assert problem properties
}
}
@ -610,8 +614,10 @@ class SolverTest extends TestCase
try {
$transaction = $this->solver->solve($this->request);
$this->fail('Unsolvable conflict did not resolve in exception.');
$this->fail('Unsolvable conflict did not result in exception.');
} catch (SolverProblemsException $e) {
$problems = $e->getProblems();
$this->assertEquals(1, count($problems));
// TODO assert problem properties
}
}