\duncan3dc\MockMockedFunction

Summary

Methods
Properties
Constants
__construct()
getFunctionName()
getArguments()
times()
zeroOrMoreTimes()
once()
twice()
never()
with()
andReturn()
matchArguments()
canAcceptArguments()
canCall()
call()
getExpectedCount()
getCalledCount()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$name
$times
$arguments
$return
$called
N/A

Properties

$name

$name : string

Type

string — The name of the function we are mocking.

$times

$times : integer

Type

integer — How many times this function should be called.

$arguments

$arguments : \duncan3dc\Mock\Arguments

Type

\duncan3dc\Mock\Arguments — The arguments this function is called with.

$return

$return : mixed

Type

mixed — The return value of this function.

$called

$called : integer

Type

integer — How many times this function has been called.

Methods

__construct()

__construct(string  $name) 

Create a new instance.

Parameters

string $name

The name of the function we are mocking

getFunctionName()

getFunctionName() : string

Get the name of the function we are mocking.

Returns

string

getArguments()

getArguments() : \duncan3dc\Mock\Arguments

Get the expected arguments for this function.

Returns

\duncan3dc\Mock\Arguments

times()

times(integer  $times) : $this

Set the number of times this function can be called.

Parameters

integer $times

The number of times to expect it

Returns

$this

zeroOrMoreTimes()

zeroOrMoreTimes() : $this

Allow this function to be called unlimited times or never at all.

Returns

$this

once()

once() : $this

Allow this function to be called exactly once.

Returns

$this

twice()

twice() : $this

Allow this function to be called exactly twice.

Returns

$this

never()

never() : $this

Ensure this function is never called.

Returns

$this

with()

with(mixed  ...$values) : $this

Set the arguments this function should be called with.

Parameters

mixed $values variadic

Returns

$this

andReturn()

andReturn(mixed  $return) : $this

Set the value this function should return.

Parameters

mixed $return

The value that will be returned

Returns

$this

matchArguments()

matchArguments(\duncan3dc\Mock\Arguments  $arguments) : boolean

Check if the specified arguments are identical to the arguments this function expects.

Parameters

\duncan3dc\Mock\Arguments $arguments

The arguments to check

Returns

boolean

canAcceptArguments()

canAcceptArguments(\duncan3dc\Mock\Arguments  $arguments) : boolean

Check if the specified arguments are acceptable for this function.

Parameters

\duncan3dc\Mock\Arguments $arguments

The arguments to check

Returns

boolean

canCall()

canCall() : boolean

Check if this function has more expectations to accept.

Returns

boolean

call()

call() : mixed

Call this function and get its return value.

Returns

mixed

getExpectedCount()

getExpectedCount() : integer

Get the number of times this function is expected to be called.

Returns

integer

getCalledCount()

getCalledCount() : integer

Get the number of times this function has been called.

Returns

integer