protected getInvocation ( array &$sequenceRecorder, $throwException = false ) : PHPUnit_Framework_MockObject_MockObject | Go\Aop\Intercept\Invocation | ||
$sequenceRecorder | array | |
return | PHPUnit_Framework_MockObject_MockObject | Go\Aop\Intercept\Invocation |
protected function getInvocation(&$sequenceRecorder, $throwException = false)
{
$invocation = $this->getMock(static::INVOCATION_CLASS);
$invocation->expects($this->any())->method('proceed')->will($this->returnCallback(function () use(&$sequenceRecorder, $throwException) {
$sequenceRecorder[] = 'invocation';
if ($throwException) {
throw new \RuntimeException('Expected exception');
}
return 'invocation';
}));
return $invocation;
}