Scheb\TwoFactorBundle\Tests\Security\TwoFactor\EventListener\RequestListenerTest::onCoreRequest_responseCreated_setResponseOnEvent PHP Method

onCoreRequest_responseCreated_setResponseOnEvent() public method

    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);
    }