You are here

public function ObjectProphecy::checkProphecyMethodsPredictions in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/phpspec/prophecy/src/Prophecy/Prophecy/ObjectProphecy.php \Prophecy\Prophecy\ObjectProphecy::checkProphecyMethodsPredictions()

Checks that registered method predictions do not fail.

Throws

\Prophecy\Exception\Prediction\AggregateException If any of registered predictions fail

File

vendor/phpspec/prophecy/src/Prophecy/Prophecy/ObjectProphecy.php, line 212

Class

ObjectProphecy
Object prophecy.

Namespace

Prophecy\Prophecy

Code

public function checkProphecyMethodsPredictions() {
  $exception = new AggregateException(sprintf("%s:\n", get_class($this
    ->reveal())));
  $exception
    ->setObjectProphecy($this);
  foreach ($this->methodProphecies as $prophecies) {
    foreach ($prophecies as $prophecy) {
      try {
        $prophecy
          ->checkPrediction();
      } catch (PredictionException $e) {
        $exception
          ->append($e);
      }
    }
  }
  if (count($exception
    ->getExceptions())) {
    throw $exception;
  }
}