public function PHPUnit_Framework_MockObject_InvocationMocker::invoke in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/phpunit/phpunit-mock-objects/src/Framework/MockObject/InvocationMocker.php \PHPUnit_Framework_MockObject_InvocationMocker::invoke()
Parameters
PHPUnit_Framework_MockObject_Invocation $invocation:
Return value
mixed
Overrides PHPUnit_Framework_MockObject_Invokable::invoke
File
- vendor/
phpunit/ phpunit-mock-objects/ src/ Framework/ MockObject/ InvocationMocker.php, line 99
Class
- PHPUnit_Framework_MockObject_InvocationMocker
- Mocker for invocations which are sent from PHPUnit_Framework_MockObject_MockObject objects.
Code
public function invoke(PHPUnit_Framework_MockObject_Invocation $invocation) {
$exception = null;
$hasReturnValue = false;
if (strtolower($invocation->methodName) == '__tostring') {
$returnValue = '';
}
else {
$returnValue = null;
}
foreach ($this->matchers as $match) {
try {
if ($match
->matches($invocation)) {
$value = $match
->invoked($invocation);
if (!$hasReturnValue) {
$returnValue = $value;
$hasReturnValue = true;
}
}
} catch (Exception $e) {
$exception = $e;
}
}
if ($exception !== null) {
throw $exception;
}
return $returnValue;
}