[Form] replaced UnexpectedValueException by InvalidArgumentException in Guess
this is a better fit because the error is a logic exception instead of a runtime exception
This commit is contained in:
parent
c0590bfd7c
commit
dcbeeb1df7
@ -97,12 +97,12 @@ abstract class Guess
|
|||||||
*
|
*
|
||||||
* @param integer $confidence The confidence
|
* @param integer $confidence The confidence
|
||||||
*
|
*
|
||||||
* @throws \UnexpectedValueException if the given value of confidence is unknown
|
* @throws \InvalidArgumentException if the given value of confidence is unknown
|
||||||
*/
|
*/
|
||||||
public function __construct($confidence)
|
public function __construct($confidence)
|
||||||
{
|
{
|
||||||
if (!in_array($confidence, self::$confidences)) {
|
if (!in_array($confidence, self::$confidences)) {
|
||||||
throw new \UnexpectedValueException(sprintf('The confidence should be one of "%s"', implode('", "', self::$confidences)));
|
throw new \InvalidArgumentException(sprintf('The confidence should be one of "%s"', implode('", "', self::$confidences)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->confidence = $confidence;
|
$this->confidence = $confidence;
|
||||||
|
@ -27,7 +27,7 @@ class GuessTest extends \PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException \UnexpectedValueException
|
* @expectedException \InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
public function testGuessExpectsValidConfidence()
|
public function testGuessExpectsValidConfidence()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user