Mock
in package
implements
MockInterface
Interfaces, Classes and Traits
Table of Contents
- $_mockery_allocatedOrder : int
- Order number of allocation
- $_mockery_allowMockingProtectedMethods : mixed
- $_mockery_container : Container
- Mock container containing this mock object
- $_mockery_currentOrder : int
- Current ordered number
- $_mockery_defaultReturnValue : mixed
- If shouldIgnoreMissing is called, this value will be returned on all calls to missing methods
- $_mockery_deferMissing : bool
- Flag to indicate whether we can defer method calls missing from our expectations
- $_mockery_disableExpectationMatching : bool
- Flag to indicate we should ignore all expectations temporarily. Used mainly to prevent expectation matching when in the middle of a mock object recording session.
- $_mockery_expectations : array<string|int, mixed>
- Stores an array of all expectation directors for this mock
- $_mockery_expectations_count : int
- Stores an initial number of expectations that can be manipulated while using the getter method.
- $_mockery_groups : array<string|int, mixed>
- Ordered groups
- $_mockery_ignoreMissing : bool
- Flag to indicate whether we can ignore method calls missing from our expectations
- $_mockery_ignoreMissingRecursive : bool
- Flag to indicate whether we want to set the ignoreMissing flag on mocks generated form this calls to this one
- $_mockery_instanceMock : mixed
- $_mockery_methods : array<string|int, ReflectionMethod>
- Just a local cache for this mock's target's methods
- $_mockery_mockableMethods : array<string|int, mixed>
- $_mockery_mockableProperties : array<string|int, mixed>
- Stores all stubbed public methods separate from any on-object public properties that may exist.
- $_mockery_name : string
- Given name of the mock
- $_mockery_partial : object
- Instance of a core object on which methods are called in the event it has been set, and an expectation for one of the object's methods does not exist. This implements a simple partial mock proxy system.
- $_mockery_receivedMethodCalls : mixed
- $_mockery_thrownExceptions : array<string|int, mixed>
- Tracks internally all the bad method call exceptions that happened during runtime
- $_mockery_verified : bool
- Flag to indicate whether this mock was verified
- __call() : mixed
- Capture calls to this mock
- __callStatic() : mixed
- __destruct() : mixed
- __isset() : mixed
- __toString() : mixed
- Forward calls to this magic method to the __call method
- __wakeup() : mixed
- allows() : self|ExpectationInterface|Expectation|HigherOrderMessage
- asUndefined() : mixed
- byDefault() : self
- In the event shouldReceive() accepting one or more methods/returns, this method will switch them from normal expectations to default expectations
- expects() : ExpectationInterface|Expectation|ExpectsHigherOrderMessage
- makePartial() : Mock
- Set mock to defer unexpected methods to it's parent
- mockery_allocateOrder() : int
- Fetch the next available allocation order number
- mockery_callSubjectMethod() : mixed
- Calls a parent class method and returns the result. Used in a passthru expectation where a real return value is required while still taking advantage of expectation matching and call count verification.
- mockery_findExpectation() : Expectation|null
- Find an expectation matching the given method and arguments
- mockery_getContainer() : Container
- Return the container for this mock
- mockery_getCurrentOrder() : int
- Get current ordered number
- mockery_getExpectationCount() : int
- Gets the count of expectations for this mock
- mockery_getExpectations() : mixed
- mockery_getExpectationsFor() : ExpectationDirector|null
- Return the expectations director for the given method
- mockery_getGroups() : array<string|int, mixed>
- Fetch array of ordered groups
- mockery_getMethod() : mixed
- mockery_getMockableMethods() : array<string|int, string>
- mockery_getMockableProperties() : array<string|int, mixed>
- mockery_getName() : string
- Return the name for this mock
- mockery_init() : void
- We want to avoid constructors since class is copied to Generator.php for inclusion on extending class definitions.
- mockery_isAnonymous() : bool
- mockery_isInstance() : mixed
- mockery_returnValueForMethod() : mixed
- mockery_setCurrentOrder() : mixed
- Set current ordered number
- mockery_setExpectationsFor() : ExpectationDirector|null
- Return the expectations director for the given method
- mockery_setGroup() : mixed
- Set ordering for a group
- mockery_teardown() : void
- Tear down tasks for this mock
- mockery_thrownExceptions() : array<string|int, mixed>
- Gets a list of exceptions thrown by this mock
- mockery_validateOrder() : void
- Validate the current mock's ordering
- mockery_verify() : void
- Iterate across all expectation directors and validate each
- shouldAllowMockingMethod() : Mock
- Allows additional methods to be mocked that do not explicitly exist on mocked class
- shouldAllowMockingProtectedMethods() : Mock
- shouldDeferMissing() : Mock
- Set mock to defer unexpected methods to it's parent
- shouldHaveBeenCalled() : mixed
- shouldHaveReceived() : mixed
- shouldIgnoreMissing() : Mock
- Set mock to ignore unexpected methods and return Undefined class
- shouldNotHaveBeenCalled() : mixed
- shouldNotHaveReceived() : mixed
- shouldNotReceive() : ExpectationInterface|Expectation|HigherOrderMessage
- Shortcut method for setting an expectation that a method should not be called.
- shouldReceive() : ExpectationInterface|Expectation|HigherOrderMessage
- Set expected method calls
- _mockery_constructorCalled() : mixed
- Called when an instance Mock was created and its constructor is getting called
- _mockery_findExpectedMethodHandler() : mixed
- _mockery_getReceivedMethodCalls() : mixed
- _mockery_handleMethodCall() : mixed
- _mockery_handleStaticMethodCall() : mixed
- mockery_getMethods() : array<string|int, mixed>
- Uses reflection to get the list of all methods within the current mock object
- getNonPublicMethods() : array<string|int, mixed>
- hasMethodOverloadingInParentClass() : mixed
Properties
$_mockery_allocatedOrder
Order number of allocation
protected
int
$_mockery_allocatedOrder
= 0
$_mockery_allowMockingProtectedMethods
protected
mixed
$_mockery_allowMockingProtectedMethods
= false
$_mockery_container
Mock container containing this mock object
protected
Container
$_mockery_container
= null
$_mockery_currentOrder
Current ordered number
protected
int
$_mockery_currentOrder
= 0
$_mockery_defaultReturnValue
If shouldIgnoreMissing is called, this value will be returned on all calls to missing methods
protected
mixed
$_mockery_defaultReturnValue
= null
$_mockery_deferMissing
Flag to indicate whether we can defer method calls missing from our expectations
protected
bool
$_mockery_deferMissing
= false
$_mockery_disableExpectationMatching
Flag to indicate we should ignore all expectations temporarily. Used mainly to prevent expectation matching when in the middle of a mock object recording session.
protected
bool
$_mockery_disableExpectationMatching
= false
$_mockery_expectations
Stores an array of all expectation directors for this mock
protected
array<string|int, mixed>
$_mockery_expectations
= array()
$_mockery_expectations_count
Stores an initial number of expectations that can be manipulated while using the getter method.
protected
int
$_mockery_expectations_count
= 0
$_mockery_groups
Ordered groups
protected
array<string|int, mixed>
$_mockery_groups
= array()
$_mockery_ignoreMissing
Flag to indicate whether we can ignore method calls missing from our expectations
protected
bool
$_mockery_ignoreMissing
= false
$_mockery_ignoreMissingRecursive
Flag to indicate whether we want to set the ignoreMissing flag on mocks generated form this calls to this one
protected
bool
$_mockery_ignoreMissingRecursive
= false
$_mockery_instanceMock
protected
mixed
$_mockery_instanceMock
= true
$_mockery_methods
Just a local cache for this mock's target's methods
protected
static array<string|int, ReflectionMethod>
$_mockery_methods
$_mockery_mockableMethods
protected
array<string|int, mixed>
$_mockery_mockableMethods
= array()
$_mockery_mockableProperties
Stores all stubbed public methods separate from any on-object public properties that may exist.
protected
array<string|int, mixed>
$_mockery_mockableProperties
= array()
$_mockery_name
Given name of the mock
protected
string
$_mockery_name
= null
$_mockery_partial
Instance of a core object on which methods are called in the event it has been set, and an expectation for one of the object's methods does not exist. This implements a simple partial mock proxy system.
protected
object
$_mockery_partial
= null
$_mockery_receivedMethodCalls
protected
mixed
$_mockery_receivedMethodCalls
$_mockery_thrownExceptions
Tracks internally all the bad method call exceptions that happened during runtime
protected
array<string|int, mixed>
$_mockery_thrownExceptions
= []
$_mockery_verified
Flag to indicate whether this mock was verified
protected
bool
$_mockery_verified
= false
Methods
__call()
Capture calls to this mock
public
__call(mixed $method, array<string|int, mixed> $args) : mixed
Parameters
- $method : mixed
- $args : array<string|int, mixed>
Return values
mixed —__callStatic()
public
static __callStatic(mixed $method, array<string|int, mixed> $args) : mixed
Parameters
- $method : mixed
- $args : array<string|int, mixed>
Return values
mixed —__destruct()
public
__destruct() : mixed
Return values
mixed —__isset()
public
__isset(mixed $name) : mixed
Parameters
- $name : mixed
Return values
mixed —__toString()
Forward calls to this magic method to the __call method
public
__toString() : mixed
Return values
mixed —__wakeup()
public
__wakeup() : mixed
Return values
mixed —allows()
public
allows([mixed $something = [] ]) : self|ExpectationInterface|Expectation|HigherOrderMessage
Parameters
- $something : mixed = []
-
String method name or map of method => return
Return values
self|ExpectationInterface|Expectation|HigherOrderMessage —asUndefined()
public
asUndefined() : mixed
Return values
mixed —byDefault()
In the event shouldReceive() accepting one or more methods/returns, this method will switch them from normal expectations to default expectations
public
byDefault() : self
Return values
self —expects()
public
expects([mixed $something = null ]) : ExpectationInterface|Expectation|ExpectsHigherOrderMessage
Parameters
- $something : mixed = null
-
String method name (optional)
Return values
ExpectationInterface|Expectation|ExpectsHigherOrderMessage —makePartial()
Set mock to defer unexpected methods to it's parent
public
makePartial() : Mock
It was an alias for shouldDeferMissing(), which will be removed in 2.0.0.
Return values
Mock —mockery_allocateOrder()
Fetch the next available allocation order number
public
mockery_allocateOrder() : int
Return values
int —mockery_callSubjectMethod()
Calls a parent class method and returns the result. Used in a passthru expectation where a real return value is required while still taking advantage of expectation matching and call count verification.
public
mockery_callSubjectMethod(string $name, array<string|int, mixed> $args) : mixed
Parameters
- $name : string
- $args : array<string|int, mixed>
Return values
mixed —mockery_findExpectation()
Find an expectation matching the given method and arguments
public
mockery_findExpectation(mixed $method, array<string|int, mixed> $args) : Expectation|null
Parameters
- $method : mixed
- $args : array<string|int, mixed>
Return values
Expectation|null —mockery_getContainer()
Return the container for this mock
public
mockery_getContainer() : Container
Return values
Container —mockery_getCurrentOrder()
Get current ordered number
public
mockery_getCurrentOrder() : int
Return values
int —mockery_getExpectationCount()
Gets the count of expectations for this mock
public
mockery_getExpectationCount() : int
Return values
int —mockery_getExpectations()
public
mockery_getExpectations() : mixed
Return values
mixed —mockery_getExpectationsFor()
Return the expectations director for the given method
public
mockery_getExpectationsFor(mixed $method) : ExpectationDirector|null
Parameters
- $method : mixed
Return values
ExpectationDirector|null —mockery_getGroups()
Fetch array of ordered groups
public
mockery_getGroups() : array<string|int, mixed>
Return values
array<string|int, mixed> —mockery_getMethod()
public
mockery_getMethod(mixed $name) : mixed
Parameters
- $name : mixed
Return values
mixed —mockery_getMockableMethods()
public
mockery_getMockableMethods() : array<string|int, string>
Return values
array<string|int, string> —mockery_getMockableProperties()
public
mockery_getMockableProperties() : array<string|int, mixed>
Return values
array<string|int, mixed> —mockery_getName()
Return the name for this mock
public
mockery_getName() : string
Return values
string —mockery_init()
We want to avoid constructors since class is copied to Generator.php for inclusion on extending class definitions.
public
mockery_init([Container $container = null ][, object $partialObject = null ][, bool $instanceMock = true ]) : void
Parameters
- $container : Container = null
- $partialObject : object = null
- $instanceMock : bool = true
Return values
void —mockery_isAnonymous()
public
mockery_isAnonymous() : bool
Return values
bool —mockery_isInstance()
public
mockery_isInstance() : mixed
Return values
mixed —mockery_returnValueForMethod()
public
mockery_returnValueForMethod(string $name) : mixed
Parameters
- $name : string
-
Method name.
Return values
mixed —Generated return value based on the declared return value of the named method.
mockery_setCurrentOrder()
Set current ordered number
public
mockery_setCurrentOrder(int $order) : mixed
Parameters
- $order : int
Return values
mixed —mockery_setExpectationsFor()
Return the expectations director for the given method
public
mockery_setExpectationsFor(mixed $method, ExpectationDirector $director) : ExpectationDirector|null
Parameters
- $method : mixed
- $director : ExpectationDirector
Return values
ExpectationDirector|null —mockery_setGroup()
Set ordering for a group
public
mockery_setGroup(mixed $group, int $order) : mixed
Parameters
- $group : mixed
- $order : int
Return values
mixed —mockery_teardown()
Tear down tasks for this mock
public
mockery_teardown() : void
Return values
void —mockery_thrownExceptions()
Gets a list of exceptions thrown by this mock
public
mockery_thrownExceptions() : array<string|int, mixed>
Return values
array<string|int, mixed> —mockery_validateOrder()
Validate the current mock's ordering
public
mockery_validateOrder(string $method, int $order) : void
Parameters
- $method : string
- $order : int
Tags
Return values
void —mockery_verify()
Iterate across all expectation directors and validate each
public
mockery_verify() : void
Tags
Return values
void —shouldAllowMockingMethod()
Allows additional methods to be mocked that do not explicitly exist on mocked class
public
shouldAllowMockingMethod(string $method) : Mock
Parameters
- $method : string
-
name of the method to be mocked
Return values
Mock —shouldAllowMockingProtectedMethods()
public
shouldAllowMockingProtectedMethods() : Mock
Return values
Mock —shouldDeferMissing()
Set mock to defer unexpected methods to it's parent
public
shouldDeferMissing() : Mock
This is particularly useless for this class, as it doesn't have a parent, but included for completeness
Tags
Return values
Mock —shouldHaveBeenCalled()
public
shouldHaveBeenCalled() : mixed
Return values
mixed —shouldHaveReceived()
public
shouldHaveReceived([mixed $method = null ][, mixed $args = null ]) : mixed
Parameters
- $method : mixed = null
- $args : mixed = null
Return values
mixed —shouldIgnoreMissing()
Set mock to ignore unexpected methods and return Undefined class
public
shouldIgnoreMissing([mixed $returnValue = null ][, bool $recursive = false ]) : Mock
Parameters
- $returnValue : mixed = null
-
the default return value for calls to missing functions on this mock
- $recursive : bool = false
-
Specify if returned mocks should also have shouldIgnoreMissing set
Return values
Mock —shouldNotHaveBeenCalled()
public
shouldNotHaveBeenCalled([array<string|int, mixed> $args = null ]) : mixed
Parameters
- $args : array<string|int, mixed> = null
Return values
mixed —shouldNotHaveReceived()
public
shouldNotHaveReceived([mixed $method = null ][, mixed $args = null ]) : mixed
Parameters
- $method : mixed = null
- $args : mixed = null
Return values
mixed —shouldNotReceive()
Shortcut method for setting an expectation that a method should not be called.
public
shouldNotReceive(string ...$methodNames) : ExpectationInterface|Expectation|HigherOrderMessage
Parameters
- $methodNames : string
-
one or many methods that are expected not to be called in this mock
Return values
ExpectationInterface|Expectation|HigherOrderMessage —shouldReceive()
Set expected method calls
public
shouldReceive(string ...$methodNames) : ExpectationInterface|Expectation|HigherOrderMessage
Parameters
- $methodNames : string
-
one or many methods that are expected to be called in this mock
Return values
ExpectationInterface|Expectation|HigherOrderMessage —_mockery_constructorCalled()
Called when an instance Mock was created and its constructor is getting called
protected
_mockery_constructorCalled(array<string|int, mixed> $args) : mixed
Parameters
- $args : array<string|int, mixed>
Tags
Return values
mixed —_mockery_findExpectedMethodHandler()
protected
_mockery_findExpectedMethodHandler(mixed $method) : mixed
Parameters
- $method : mixed
Return values
mixed —_mockery_getReceivedMethodCalls()
protected
_mockery_getReceivedMethodCalls() : mixed
Return values
mixed —_mockery_handleMethodCall()
protected
_mockery_handleMethodCall(mixed $method, array<string|int, mixed> $args) : mixed
Parameters
- $method : mixed
- $args : array<string|int, mixed>
Return values
mixed —_mockery_handleStaticMethodCall()
protected
static _mockery_handleStaticMethodCall(mixed $method, array<string|int, mixed> $args) : mixed
Parameters
- $method : mixed
- $args : array<string|int, mixed>
Return values
mixed —mockery_getMethods()
Uses reflection to get the list of all methods within the current mock object
protected
mockery_getMethods() : array<string|int, mixed>
Return values
array<string|int, mixed> —getNonPublicMethods()
private
getNonPublicMethods() : array<string|int, mixed>
Return values
array<string|int, mixed> —hasMethodOverloadingInParentClass()
private
hasMethodOverloadingInParentClass() : mixed