Documentation

MockInterface extends LegacyMockInterface
in

Table of Contents

allows()  : self|ExpectationInterface|Expectation|HigherOrderMessage
byDefault()  : self
In the event shouldReceive() accepting an array of 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 its parent if possible
mockery_allocateOrder()  : int
Fetch the next available allocation order number
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_getExpectationsFor()  : ExpectationDirector|null
Return the expectations director for the given method
mockery_getGroups()  : array<string|int, mixed>
Fetch array of ordered groups
mockery_getMockableMethods()  : array<string|int, string>
mockery_getMockableProperties()  : array<string|int, mixed>
mockery_getName()  : string
Return the name for this mock
mockery_init()  : void
Alternative setup method to constructor
mockery_isAnonymous()  : bool
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_validateOrder()  : void
Validate the current mock's ordering
mockery_verify()  : void
Iterate across all expectation directors and validate each
shouldAllowMockingMethod()  : mixed
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 its parent if possible
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

Methods

byDefault()

In the event shouldReceive() accepting an array of methods/returns this method will switch them from normal expectations to default expectations

public byDefault() : self
Return values
self

makePartial()

Set mock to defer unexpected methods to its parent if possible

public makePartial() : Mock
Return values
Mock

mockery_allocateOrder()

Fetch the next available allocation order number

public mockery_allocateOrder() : int
Return values
int

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_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_getGroups()

Fetch array of ordered groups

public mockery_getGroups() : array<string|int, mixed>
Return values
array<string|int, 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()

Alternative setup method to constructor

public mockery_init([Container $container = null ][, object $partialObject = null ]) : void
Parameters
$container : Container = null
$partialObject : object = null
Return values
void

mockery_setCurrentOrder()

Set current ordered number

public mockery_setCurrentOrder(int $order) : mixed
Parameters
$order : int
Return values
mixed

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_validateOrder()

Validate the current mock's ordering

public mockery_validateOrder(string $method, int $order) : void
Parameters
$method : string
$order : int
Tags
throws
Exception
Return values
void

mockery_verify()

Iterate across all expectation directors and validate each

public mockery_verify() : void
Tags
throws
Exception
Return values
void

shouldAllowMockingMethod()

Allows additional methods to be mocked that do not explicitly exist on mocked class

public shouldAllowMockingMethod(string $method) : mixed
Parameters
$method : string

name of the method to be mocked

Return values
mixed

shouldDeferMissing()

Set mock to defer unexpected methods to its parent if possible

public shouldDeferMissing() : Mock
Tags
deprecated

since 1.4.0. Please use makePartial() instead.

Return values
Mock

shouldHaveBeenCalled()

public shouldHaveBeenCalled() : mixed
Return values
mixed

shouldHaveReceived()

public shouldHaveReceived(null|string $method[, null|array<string|int, mixed>|Closure $args = null ]) : mixed
Parameters
$method : null|string
$args : null|array<string|int, mixed>|Closure = null
Return values
mixed

shouldIgnoreMissing()

Set mock to ignore unexpected methods and return Undefined class

public shouldIgnoreMissing([mixed $returnValue = null ]) : Mock
Parameters
$returnValue : mixed = null

the default return value for calls to missing functions on this mock

Return values
Mock

shouldNotHaveBeenCalled()

public shouldNotHaveBeenCalled([array<string|int, mixed> $args = null ]) : mixed
Parameters
$args : array<string|int, mixed> = null

(optional)

Return values
mixed

shouldNotHaveReceived()

public shouldNotHaveReceived(null|string $method[, null|array<string|int, mixed>|Closure $args = null ]) : mixed
Parameters
$method : null|string
$args : null|array<string|int, mixed>|Closure = null
Return values
mixed

Search results