Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. NoCallsPrediction.php

class NoCallsPrediction

Tests that there were no calls made.

@author Konstantin Kudryashov <ever.zet@gmail.com>

Hierarchy

  • class \Prophecy\Prediction\NoCallsPrediction implements \Prophecy\Prediction\PredictionInterface

Expanded class hierarchy of NoCallsPrediction

File

vendor/phpspec/prophecy/src/Prophecy/Prediction/NoCallsPrediction.php, line 25

Namespace

Prophecy\Prediction
View source
class NoCallsPrediction implements PredictionInterface {
    private $util;
    public function __construct(?StringUtil $util = null) {
        $this->util = $util ?: new StringUtil();
    }
    public function check(array $calls, ObjectProphecy $object, MethodProphecy $method) {
        if (!count($calls)) {
            return;
        }
        $verb = count($calls) === 1 ? 'was' : 'were';
        throw new UnexpectedCallsException(sprintf("No calls expected that match:\n" . "  %s->%s(%s)\n" . "but %d %s made:\n%s", get_class($object->reveal()), $method->getMethodName(), $method->getArgumentsWildcard(), count($calls), $verb, $this->util
            ->stringifyCalls($calls)), $method, $calls);
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
NoCallsPrediction::$util private property
NoCallsPrediction::check public function Tests that double fulfilled prediction. Overrides PredictionInterface::check
NoCallsPrediction::__construct public function
RSS feed
Powered by Drupal