ExceptionListener example



    private function createEvent(\Exception $exception$kernel = null)
    {
        $kernel ??= $this->createMock(HttpKernelInterface::class);

        return new ExceptionEvent($kernel, Request::create('/'), HttpKernelInterface::MAIN_REQUEST, $exception);
    }

    private function createExceptionListener(TokenStorageInterface $tokenStorage = null, AuthenticationTrustResolverInterface $trustResolver = null, HttpUtils $httpUtils = null, AuthenticationEntryPointInterface $authenticationEntryPoint = null, $errorPage = null, AccessDeniedHandlerInterface $accessDeniedHandler = null)
    {
        return new ExceptionListener(
            $tokenStorage ?? $this->createMock(TokenStorageInterface::class),
            $trustResolver ?? $this->createMock(AuthenticationTrustResolverInterface::class),
            $httpUtils ?? $this->createMock(HttpUtils::class),
            'key',
            $authenticationEntryPoint,
            $errorPage,
            $accessDeniedHandler
        );
    }
}
Home | Imprint | This part of the site doesn't use cookies.