You are here

public function Prophet::checkPredictions in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpspec/prophecy/src/Prophecy/Prophet.php \Prophecy\Prophet::checkPredictions()

Checks all predictions defined by prophecies of this Prophet.

Throws

Exception\Prediction\AggregateException If any prediction fails

File

vendor/phpspec/prophecy/src/Prophecy/Prophet.php, line 119

Class

Prophet
Prophet creates prophecies.

Namespace

Prophecy

Code

public function checkPredictions() {
  $exception = new AggregateException("Some predictions failed:\n");
  foreach ($this->prophecies as $prophecy) {
    try {
      $prophecy
        ->checkProphecyMethodsPredictions();
    } catch (PredictionException $e) {
      $exception
        ->append($e);
    }
  }
  if (count($exception
    ->getExceptions())) {
    throw $exception;
  }
}