public function testOnControllerArguments(callable
$controller) { $listener =
new ErrorListener($controller,
$this->
createMock(LoggerInterface::
class), true
);
$kernel =
$this->
createMock(HttpKernelInterface::
class);
$kernel->
method('handle'
)->
willReturnCallback(function DRequest
$request) use ($listener,
$controller,
$kernel) { $this->
assertSame($controller,
$request->attributes->
get('_controller'
));
$arguments =
(new ArgumentResolver())->
getArguments($request,
$controller);
$event =
new ControllerArgumentsEvent($kernel,
$controller,
$arguments,
$request, HttpKernelInterface::SUB_REQUEST
);
$listener->
onControllerArguments($event);
return $controller(...
$event->
getArguments());
});
$event =
new ExceptionEvent($kernel, Request::
create('/'
), HttpKernelInterface::MAIN_REQUEST,
new \
Exception('foo'
));
$listener->
onKernelException($event);
$this->
assertSame('OK: foo',
$event->
getResponse()->
getContent());
} public static function controllerProvider() {