function 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 341
Class
- MethodProphecy
- Method prophecy.
Namespace
Prophecy\ProphecyCode
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;
}