function ObjectProphecy::checkProphecyMethodsPredictions
Checks that registered method predictions do not fail.
Return value
void
Throws
\Prophecy\Exception\Prediction\AggregateException If any of registered predictions fail
\Prophecy\Exception\Call\UnexpectedCallException
File
-
vendor/
phpspec/ prophecy/ src/ Prophecy/ Prophecy/ ObjectProphecy.php, line 219
Class
- ObjectProphecy
- @author Konstantin Kudryashov <ever.zet@gmail.com>
Namespace
Prophecy\ProphecyCode
public function checkProphecyMethodsPredictions() {
$exception = new AggregateException(sprintf("%s:\n", get_class($this->reveal())));
$exception->setObjectProphecy($this);
$this->callCenter
->checkUnexpectedCalls();
foreach ($this->methodProphecies as $prophecies) {
foreach ($prophecies as $prophecy) {
try {
$prophecy->checkPrediction();
} catch (PredictionException $e) {
$exception->append($e);
}
}
}
if (count($exception->getExceptions())) {
throw $exception;
}
}