You are here

public function MethodProphecy::should in Zircon Profile 8.0

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

Sets custom prediction to the prophecy.

Parameters

callable|Prediction\PredictionInterface $prediction:

Return value

$this

Throws

\Prophecy\Exception\InvalidArgumentException

3 calls to MethodProphecy::should()
MethodProphecy::shouldBeCalled in vendor/phpspec/prophecy/src/Prophecy/Prophecy/MethodProphecy.php
Sets call prediction to the prophecy.
MethodProphecy::shouldBeCalledTimes in vendor/phpspec/prophecy/src/Prophecy/Prophecy/MethodProphecy.php
Sets call times prediction to the prophecy.
MethodProphecy::shouldNotBeCalled in vendor/phpspec/prophecy/src/Prophecy/Prophecy/MethodProphecy.php
Sets no calls prediction to the prophecy.

File

vendor/phpspec/prophecy/src/Prophecy/Prophecy/MethodProphecy.php, line 205

Class

MethodProphecy
Method prophecy.

Namespace

Prophecy\Prophecy

Code

public function should($prediction) {
  if (is_callable($prediction)) {
    $prediction = new Prediction\CallbackPrediction($prediction);
  }
  if (!$prediction instanceof Prediction\PredictionInterface) {
    throw new InvalidArgumentException(sprintf('Expected callable or instance of PredictionInterface, but got %s.', gettype($prediction)));
  }
  $this
    ->bindToObjectProphecy();
  $this->prediction = $prediction;
  return $this;
}