public function onCoreRequest_responseCreated_setResponseOnEvent()
{
$event = $this->createEvent();
$token = $this->createSupportedSecurityToken();
$this->stubTokenStorage($token);
$response = $this->createMock('Symfony\\Component\\HttpFoundation\\Response');
$expectedContext = new AuthenticationContext($this->request, $token);
$this->authenticationContextFactory->method('create')->willReturn($expectedContext);
//Stub the TwoFactorProvider
$this->authHandler->expects($this->any())->method('requestAuthenticationCode')->willReturn($response);
//Expect response to be set
$event->expects($this->once())->method('setResponse')->with($response);
$this->listener->onCoreRequest($event);
}