1
0
Fork 0

Create an impossible rule when trying to install something that doesn't exist.

The rule isn't acted upon yet (hence the incomplete test) but it is there as a reminder that this case needs to be handled.
pull/324/head
Volker Dusch 2012-02-19 14:55:14 +01:00
parent c97a33577b
commit eafe13d5a5
2 changed files with 22 additions and 0 deletions

View File

@ -964,6 +964,12 @@ class Solver
foreach ($this->jobs as $job) { foreach ($this->jobs as $job) {
if (empty($job['packages']) && $job['cmd'] == 'install') {
$this->addRule(
RuleSet::TYPE_JOB,
$this->createImpossibleRule(static::RULE_JOB_INSTALL, $job)
);
}
foreach ($job['packages'] as $package) { foreach ($job['packages'] as $package) {
switch ($job['cmd']) { switch ($job['cmd']) {
case 'install': case 'install':

View File

@ -55,6 +55,22 @@ class SolverTest extends TestCase
)); ));
} }
public function testInstallNonExistingPackageFails()
{
$this->repo->addPackage($this->getPackage('A', '1.0'));
$this->reposComplete();
$this->request->install('B');
try {
$transaction = $this->solver->solve($this->request);
$this->markTestIncomplete('Reporting this failure is not implemented/working yet');
//$this->fail('Unsolvable conflict did not resolve in exception.');
} catch (SolverProblemsException $e) {
// @todo: assert problem properties
}
}
public function testSolverInstallWithDeps() public function testSolverInstallWithDeps()
{ {
$this->repo->addPackage($packageA = $this->getPackage('A', '1.0')); $this->repo->addPackage($packageA = $this->getPackage('A', '1.0'));