public function it_handles_authorization_refusal(AuthorizeControllerInterface $oauth2AuthorizeController, ParameterBag $requestBag, Application $app, Request $request, TokenStorageInterface $tokenStorage)
 {
     $app->offsetGet('security.token_storage')->willReturn($tokenStorage);
     $requestBag->all()->willReturn(['authorize' => '0']);
     $responseArgument = Argument::type('OAuth2\\HttpFoundationBridge\\Response');
     $requestArgument = Argument::type('OAuth2\\HttpFoundationBridge\\Request');
     $oauth2AuthorizeController->handleAuthorizeRequest($requestArgument, $responseArgument, false, null)->shouldBeCalled();
     $response = $this->__invoke($app, $request);
     $response->shouldHaveType('OAuth2\\HttpFoundationBridge\\Response');
     $response->getStatusCode()->shouldReturn(200);
 }
 public function it_renders_authenticated_authorize_view(UrlGeneratorInterface $urlGenerator, AuthorizeControllerInterface $oauth2AuthorizeController, AuthorizeRenderer $authorizeRenderer, Application $app, Request $request, ParameterBag $queryBag, BridgeResponse $response, TokenStorageInterface $tokenStorage, TokenInterface $token)
 {
     $responseArgument = Argument::type('OAuth2\\HttpFoundationBridge\\Response');
     $requestArgument = Argument::type('OAuth2\\HttpFoundationBridge\\Request');
     $oauth2AuthorizeController->validateAuthorizeRequest($requestArgument, $responseArgument)->willReturn(true);
     $urlGenerator->generate('oauth2_authorize_handler', Argument::any())->willReturn('/url');
     $queryBag->all()->willReturn(['client_id' => 'clientId', 'response_type' => 'responseType']);
     $app->offsetGet('security.token_storage')->willReturn($tokenStorage);
     $tokenStorage->getToken()->willReturn($token);
     $token->getUser()->willReturn('user');
     $authorizeRenderer->render('/url', 'clientId', 'responseType', 'user')->willReturn($response);
     $this->__invoke($app, $request)->shouldReturn($response);
 }