MethodProphecy
in package
Method prophecy.
Tags
Table of Contents
- $argumentsWildcard : mixed
- $bound : mixed
- $checkedPredictions : mixed
- $methodName : mixed
- $objectProphecy : mixed
- $prediction : mixed
- $promise : mixed
- $voidReturnType : mixed
- __construct() : mixed
- Initializes method prophecy.
- checkPrediction() : mixed
- Checks currently registered [with should(...)] prediction.
- getArgumentsWildcard() : ArgumentsWildcard
- Returns arguments wildcard.
- getCheckedPredictions() : array<string|int, PredictionInterface>
- Returns predictions that were checked on this object.
- getMethodName() : string
- Returns method name.
- getObjectProphecy() : ObjectProphecy
- Returns object prophecy this method prophecy is tied to.
- getPrediction() : null|PredictionInterface
- Returns currently registered prediction.
- getPromise() : null|PromiseInterface
- Returns currently registered promise.
- hasReturnVoid() : bool
- should() : $this
- Sets custom prediction to the prophecy.
- shouldBeCalled() : $this
- Sets call prediction to the prophecy.
- shouldBeCalledOnce() : $this
- Sets call times prediction to the prophecy.
- shouldBeCalledTimes() : $this
- Sets call times prediction to the prophecy.
- shouldHave() : $this
- Checks provided prediction immediately.
- shouldHaveBeenCalled() : $this
- Checks call prediction.
- shouldHaveBeenCalledOnce() : $this
- Checks call times prediction.
- shouldHaveBeenCalledTimes() : $this
- Checks call times prediction.
- shouldNotBeCalled() : $this
- Sets no calls prediction to the prophecy.
- shouldNotBeenCalled() : $this
- Checks no calls prediction.
- shouldNotHaveBeenCalled() : $this
- Checks no calls prediction.
- will() : $this
- Sets custom promise to the prophecy.
- willReturn() : $this
- Sets return promise to the prophecy.
- willReturnArgument() : $this
- Sets return argument promise to the prophecy.
- willThrow() : $this
- Sets throw promise to the prophecy.
- willYield() : $this
- withArguments() : $this
- Sets argument wildcard.
- bindToObjectProphecy() : mixed
Properties
$argumentsWildcard
private
mixed
$argumentsWildcard
$bound
private
mixed
$bound
= false
$checkedPredictions
private
mixed
$checkedPredictions
= array()
$methodName
private
mixed
$methodName
$objectProphecy
private
mixed
$objectProphecy
$prediction
private
mixed
$prediction
$promise
private
mixed
$promise
$voidReturnType
private
mixed
$voidReturnType
= false
Methods
__construct()
Initializes method prophecy.
public
__construct(ObjectProphecy $objectProphecy, string $methodName[, null|ArgumentsWildcard|array<string|int, mixed> $arguments = null ]) : mixed
Parameters
- $objectProphecy : ObjectProphecy
- $methodName : string
- $arguments : null|ArgumentsWildcard|array<string|int, mixed> = null
Tags
Return values
mixed —checkPrediction()
Checks currently registered [with should(...)] prediction.
public
checkPrediction() : mixed
Return values
mixed —getArgumentsWildcard()
Returns arguments wildcard.
public
getArgumentsWildcard() : ArgumentsWildcard
Return values
ArgumentsWildcard —getCheckedPredictions()
Returns predictions that were checked on this object.
public
getCheckedPredictions() : array<string|int, PredictionInterface>
Return values
array<string|int, PredictionInterface> —getMethodName()
Returns method name.
public
getMethodName() : string
Return values
string —getObjectProphecy()
Returns object prophecy this method prophecy is tied to.
public
getObjectProphecy() : ObjectProphecy
Return values
ObjectProphecy —getPrediction()
Returns currently registered prediction.
public
getPrediction() : null|PredictionInterface
Return values
null|PredictionInterface —getPromise()
Returns currently registered promise.
public
getPromise() : null|PromiseInterface
Return values
null|PromiseInterface —hasReturnVoid()
public
hasReturnVoid() : bool
Return values
bool —should()
Sets custom prediction to the prophecy.
public
should(callable|PredictionInterface $prediction) : $this
Parameters
- $prediction : callable|PredictionInterface
Tags
Return values
$this —shouldBeCalled()
Sets call prediction to the prophecy.
public
shouldBeCalled() : $this
Tags
Return values
$this —shouldBeCalledOnce()
Sets call times prediction to the prophecy.
public
shouldBeCalledOnce() : $this
Tags
Return values
$this —shouldBeCalledTimes()
Sets call times prediction to the prophecy.
public
shouldBeCalledTimes( $count) : $this
Parameters
Tags
Return values
$this —shouldHave()
Checks provided prediction immediately.
public
shouldHave(callable|PredictionInterface $prediction) : $this
Parameters
- $prediction : callable|PredictionInterface
Tags
Return values
$this —shouldHaveBeenCalled()
Checks call prediction.
public
shouldHaveBeenCalled() : $this
Tags
Return values
$this —shouldHaveBeenCalledOnce()
Checks call times prediction.
public
shouldHaveBeenCalledOnce() : $this
Tags
Return values
$this —shouldHaveBeenCalledTimes()
Checks call times prediction.
public
shouldHaveBeenCalledTimes(int $count) : $this
Parameters
- $count : int
Tags
Return values
$this —shouldNotBeCalled()
Sets no calls prediction to the prophecy.
public
shouldNotBeCalled() : $this
Tags
Return values
$this —shouldNotBeenCalled()
Checks no calls prediction.
public
shouldNotBeenCalled() : $this
Tags
Return values
$this —shouldNotHaveBeenCalled()
Checks no calls prediction.
public
shouldNotHaveBeenCalled() : $this
Tags
Return values
$this —will()
Sets custom promise to the prophecy.
public
will(callable|PromiseInterface $promise) : $this
Parameters
- $promise : callable|PromiseInterface
Tags
Return values
$this —willReturn()
Sets return promise to the prophecy.
public
willReturn() : $this
Tags
Return values
$this —willReturnArgument()
Sets return argument promise to the prophecy.
public
willReturnArgument([int $index = 0 ]) : $this
Parameters
- $index : int = 0
-
The zero-indexed number of the argument to return
Tags
Return values
$this —willThrow()
Sets throw promise to the prophecy.
public
willThrow(string|Exception $exception) : $this
Parameters
- $exception : string|Exception
-
Exception class or instance
Tags
Return values
$this —willYield()
public
willYield(array<string|int, mixed> $items[, mixed $return = null ]) : $this
Parameters
- $items : array<string|int, mixed>
- $return : mixed = null
Tags
Return values
$this —withArguments()
Sets argument wildcard.
public
withArguments(array<string|int, mixed>|ArgumentsWildcard $arguments) : $this
Parameters
- $arguments : array<string|int, mixed>|ArgumentsWildcard
Tags
Return values
$this —bindToObjectProphecy()
private
bindToObjectProphecy() : mixed