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
parent
09e31bf704
commit
5160dd2f5e
|
@ -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()
|
||||||
|
|
|
@ -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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue