1
0
Fork 0

Return different error code for SolverProblemsException

To make it easier for external tools to detect SolverProblems and react
to them accordingly,
this PR introduces a new exit code.
pull/1827/head
Robert Gruendler 2013-04-25 11:26:34 +02:00
parent 09e31bf704
commit 5160dd2f5e
2 changed files with 2 additions and 1 deletions

View File

@ -25,7 +25,7 @@ class SolverProblemsException extends \RuntimeException
$this->problems = $problems; $this->problems = $problems;
$this->installedMap = $installedMap; $this->installedMap = $installedMap;
parent::__construct($this->createMessage()); parent::__construct($this->createMessage(), 2);
} }
protected function createMessage() protected function createMessage()

View File

@ -75,6 +75,7 @@ class SolverTest extends TestCase
} catch (SolverProblemsException $e) { } catch (SolverProblemsException $e) {
$problems = $e->getProblems(); $problems = $e->getProblems();
$this->assertEquals(1, count($problems)); $this->assertEquals(1, count($problems));
$this->assertEquals(2, $e->getCode());
$this->assertEquals("\n - The requested package b could not be found in any version, there may be a typo in the package name.", $problems[0]->getPrettyString()); $this->assertEquals("\n - The requested package b could not be found in any version, there may be a typo in the package name.", $problems[0]->getPrettyString());
} }
} }