$this->
expectException(ConflictingHeadersException::
class);
$dispatcher =
new EventDispatcher();
$kernel =
$this->
createMock(HttpKernelInterface::
class);
$request =
new Request();
$request->
setTrustedProxies(['1.1.1.1'
], Request::HEADER_X_FORWARDED_FOR | Request::HEADER_FORWARDED
);
$request->server->
set('REMOTE_ADDR', '1.1.1.1'
);
$request->headers->
set('FORWARDED', 'for=2.2.2.2'
);
$request->headers->
set('X_FORWARDED_FOR', '3.3.3.3'
);
$dispatcher->
addListener(KernelEvents::REQUEST,
[new ValidateRequestListener(), 'onKernelRequest'
]);
$event =
new RequestEvent($kernel,
$request, HttpKernelInterface::MAIN_REQUEST
);
$dispatcher->
dispatch($event, KernelEvents::REQUEST
);
}}