Sets up the wildcard and everything else empty.
SimpleStub
SimpleStub
(mixed $wildcard, [boolean$is_strict $is_strict = true])
-
mixed
$wildcard: Parameter matching wildcard.
-
boolean$is_strict
$is_strict: Enables method name checks.
Fetches the call count of a method so far.
Number
getCallCount
(string $method)
-
string
$method: Method name called.
Sets a return for a parameter list that will be passed by reference for all calls.
void
setReturnReference
(string $method, mixed &$reference, [array $args = false])
-
string
$method: Method name.
-
mixed
$reference: Result of the call will be this object.
-
array
$args: List of parameters to match including wildcards.
Sets a return for a parameter list that will be passed by value only when the required call count is reached.
void
setReturnReferenceAt
(integer $timing, string $method, mixed &$reference, [array $args = false])
-
integer
$timing: Number of calls in the future to which the result applies. If not set then all calls will return the value.
-
string
$method: Method name.
-
mixed
$reference: Result of the call will be this object.
-
array
$args: List of parameters to match including wildcards.
Sets a return for a parameter list that will be passed by value for all calls to this method.
void
setReturnValue
(string $method, mixed $value, [array $args = false])
-
string
$method: Method name.
-
mixed
$value: Result of call passed by value.
-
array
$args: List of parameters to match including wildcards.
Sets a return for a parameter list that will be passed by value only when the required call count is reached.
void
setReturnValueAt
(integer $timing, string $method, mixed $value, [array $args = false])
-
integer
$timing: Number of calls in the future to which the result applies. If not set then all calls will return the value.
-
string
$method: Method name.
-
mixed
$value: Result of call passed by value.
-
array
$args: List of parameters to match including wildcards.
Adds one to the call count of a method.
void
_addCall
(string $method, array $args)
-
string
$method: Method called.
-
array
$args: Arguments as an array.
Triggers a PHP error if the method is not part of this object.
void
_dieOnNoMethod
(string $method, string $task)
-
string
$method: Name of method.
-
string
$task: Description of task attempt.
Finds the return value matching the incoming arguments. If there is no matching value found then an error is triggered.
mixed
&_getReturn
(string $method, array $args, integer $step)
-
string
$method: Method name.
-
array
$args: Calling arguments.
-
integer
$step: Current position in the call history.
Returns the expected value for the method name.
mixed
&_invoke
(string $method, array $args)
-
string
$method: Name of method to simulate.
-
array
$args: Arguments as an array.
Redefined in descendants as:
-
SimpleMock::_invoke()
: Returns the expected value for the method name and checks expectations. Will generate any test assertions as a result of expectations if there is a test present.
Replaces wildcard matches with wildcard expectations in the argument list.
array
_replaceWildcards
(array $args)
-
array
$args: Raw argument list.
What to do if there is no return value set. Does nothing for a stub.
void
_warnOnNoReturn
(string $method)
-
string
$method: Method name.
Redefined in descendants as: