ExpectationDirector
in package
Table of Contents
- $_defaults : array<string|int, mixed>
- Stores an array of all default expectations for this mock
- $_expectations : array<string|int, mixed>
- Stores an array of all expectations for this mock
- $_expectedOrder : int
- The expected order of next call
- $_mock : MockInterface|LegacyMockInterface
- Mock object the director is attached to
- $_name : string
- Method name the director is directing
- __construct() : mixed
- Constructor
- addExpectation() : mixed
- Add a new expectation to the director
- call() : mixed
- Handle a method call being directed by this instance
- findExpectation() : mixed
- Attempt to locate an expectation matching the provided args
- getDefaultExpectations() : array<string|int, mixed>
- Return all expectations assigned to this director
- getExpectationCount() : int
- Return the number of expectations assigned to this director.
- getExpectations() : array<string|int, mixed>
- Return all expectations assigned to this director
- makeExpectationDefault() : mixed
- Make the given expectation a default for all others assuming it was correctly created last
- verify() : void
- Verify all expectations of the director
- _findExpectationIn() : mixed
- Search current array of expectations for a match
Properties
$_defaults
Stores an array of all default expectations for this mock
protected
array<string|int, mixed>
$_defaults
= array()
$_expectations
Stores an array of all expectations for this mock
protected
array<string|int, mixed>
$_expectations
= array()
$_expectedOrder
The expected order of next call
protected
int
$_expectedOrder
= null
$_mock
Mock object the director is attached to
protected
MockInterface|LegacyMockInterface
$_mock
= null
$_name
Method name the director is directing
protected
string
$_name
= null
Methods
__construct()
Constructor
public
__construct(string $name, LegacyMockInterface $mock) : mixed
Parameters
- $name : string
- $mock : LegacyMockInterface
Return values
mixed —addExpectation()
Add a new expectation to the director
public
addExpectation(Expectation $expectation) : mixed
Parameters
- $expectation : Expectation
Return values
mixed —call()
Handle a method call being directed by this instance
public
call(array<string|int, mixed> $args) : mixed
Parameters
- $args : array<string|int, mixed>
Return values
mixed —findExpectation()
Attempt to locate an expectation matching the provided args
public
findExpectation(array<string|int, mixed> $args) : mixed
Parameters
- $args : array<string|int, mixed>
Return values
mixed —getDefaultExpectations()
Return all expectations assigned to this director
public
getDefaultExpectations() : array<string|int, mixed>
Return values
array<string|int, mixed> —getExpectationCount()
Return the number of expectations assigned to this director.
public
getExpectationCount() : int
Return values
int —getExpectations()
Return all expectations assigned to this director
public
getExpectations() : array<string|int, mixed>
Return values
array<string|int, mixed> —makeExpectationDefault()
Make the given expectation a default for all others assuming it was correctly created last
public
makeExpectationDefault(Expectation $expectation) : mixed
Parameters
- $expectation : Expectation
Return values
mixed —verify()
Verify all expectations of the director
public
verify() : void
Tags
Return values
void —_findExpectationIn()
Search current array of expectations for a match
protected
_findExpectationIn(array<string|int, mixed> $expectations, array<string|int, mixed> $args) : mixed
Parameters
- $expectations : array<string|int, mixed>
- $args : array<string|int, mixed>