[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:
Tobias Schultze 2012-08-27 06:13:48 +02:00
parent c0590bfd7c
commit dcbeeb1df7
2 changed files with 3 additions and 3 deletions

View File

@ -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;

View File

@ -27,7 +27,7 @@ class GuessTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* @expectedException \UnexpectedValueException * @expectedException \InvalidArgumentException
*/ */
public function testGuessExpectsValidConfidence() public function testGuessExpectsValidConfidence()
{ {