interface PHPUnit_Framework_MockObject_Builder_MethodNameMatch implements PHPUnit_Framework_MockObject_Builder_ParametersMatch (View source)

Builder interface for matcher of method names.

Methods

id(string $id)

Sets the identification of the expectation to $id.

will(PHPUnit_Framework_MockObject_Stub $stub)

Stubs the matching method with the stub object $stub. Any invocations of the matched method will now be handled by the stub instead.

after(string $id)

Defines the expectation which must occur before the current is valid.

with($arguments)

Sets the parameters to match for, each parameter to this funtion will be part of match. To perform specific matches or constraints create a new PHPUnitFrameworkConstraint and use it for the parameter.

method(PHPUnit_Framework_Constraint $name)

Adds a new method name match and returns the parameter match object for further matching possibilities.

Details

id(string $id)

Sets the identification of the expectation to $id.

Parameters

string $id Unique identification of expectation.

PHPUnit_Framework_MockObject_Builder_Identity will(PHPUnit_Framework_MockObject_Stub $stub)

Stubs the matching method with the stub object $stub. Any invocations of the matched method will now be handled by the stub instead.

PHPUnit_Framework_MockObject_Builder_Stub after(string $id)

Defines the expectation which must occur before the current is valid.

Parameters

string $id The identification of the expectation that should occur before this one.

Return Value

PHPUnit_Framework_MockObject_Builder_Stub

PHPUnit_Framework_MockObject_Builder_ParametersMatch with($arguments)

Sets the parameters to match for, each parameter to this funtion will be part of match. To perform specific matches or constraints create a new PHPUnitFrameworkConstraint and use it for the parameter.

If the parameter value is not a constraint it will use the PHPUnitFrameworkConstraint_IsEqual for the value.

Some examples: // match first parameter with value 2 $b->with(2); // match first parameter with value 'smock' and second identical to 42 $b->with('smock', new PHPUnitFrameworkConstraint_IsEqual(42));

Parameters

$arguments

Return Value

PHPUnit_Framework_MockObject_Builder_ParametersMatch

PHPUnit_Framework_MockObject_Matcher_AnyParameters withAnyParameters()

Sets a matcher which allows any kind of parameters.

Some examples: // match any number of parameters $b->withAnyParameters();

PHPUnit_Framework_MockObject_Builder_ParametersMatch method(PHPUnit_Framework_Constraint $name)

Adds a new method name match and returns the parameter match object for further matching possibilities.

Parameters

PHPUnit_Framework_Constraint $name Constraint for matching method, if a string is passed it will use the PHPUnitFrameworkConstraint_IsEqual

Return Value

PHPUnit_Framework_MockObject_Builder_ParametersMatch