Fakes the processing of the invocation $invocation by returning a specific value.
PHPUnit_Framework_MockObject_Invocation $invocation: The invocation which was mocked and matched by the current method and argument matchers.
mixed
Overrides PHPUnit_Framework_MockObject_Stub::invoke
public function invoke(PHPUnit_Framework_MockObject_Invocation $invocation) {
$parameterCount = count($invocation->parameters);
foreach ($this->valueMap as $map) {
if (!is_array($map) || $parameterCount != count($map) - 1) {
continue;
}
$return = array_pop($map);
if ($invocation->parameters === $map) {
return $return;
}
}
return NULL;
}