protected function setUp()
 {
     parent::setUp();
     $this->container = new Container();
     $this->container->setParameter('hwi_oauth.templating.engine', 'twig');
     $this->container->setParameter('hwi_oauth.connect', true);
     $this->container->setParameter('hwi_oauth.firewall_names', array('default'));
     $this->container->setParameter('hwi_oauth.connect.confirmation', true);
     if (interface_exists('Symfony\\Component\\Security\\Core\\Authorization\\AuthorizationCheckerInterface')) {
         $this->authorizationChecker = $this->getMockBuilder('\\Symfony\\Component\\Security\\Core\\Authorization\\AuthorizationCheckerInterface')->getMock();
         $this->container->set('security.authorization_checker', $this->authorizationChecker);
         $this->tokenStorage = $this->getMockBuilder('\\Symfony\\Component\\Security\\Core\\Authentication\\Token\\Storage\\TokenStorageInterface')->getMock();
         $this->container->set('security.token_storage', $this->tokenStorage);
     } else {
         $this->securityContext = $this->getMockBuilder('\\Symfony\\Component\\Security\\Core\\SecurityContextInterface')->getMock();
         $this->container->set('security.context', $this->securityContext);
     }
     $this->templating = $this->getMockBuilder('Symfony\\Bundle\\FrameworkBundle\\Templating\\EngineInterface')->getMock();
     $this->container->set('templating', $this->templating);
     $this->router = $this->getMockBuilder('Symfony\\Component\\Routing\\RouterInterface')->getMock();
     $this->container->set('router', $this->router);
     $this->resourceOwner = $this->getMockBuilder('HWI\\Bundle\\OAuthBundle\\OAuth\\ResourceOwnerInterface')->getMock();
     $this->resourceOwner->expects($this->any())->method('getUserInformation')->willReturn(new CustomUserResponse());
     $this->resourceOwnerMap = $this->getMockBuilder('HWI\\Bundle\\OAuthBundle\\Security\\Http\\ResourceOwnerMap')->disableOriginalConstructor()->getMock();
     $this->resourceOwnerMap->expects($this->any())->method('getResourceOwnerByName')->withAnyParameters()->willReturn($this->resourceOwner);
     $this->container->set('hwi_oauth.resource_ownermap.default', $this->resourceOwnerMap);
     $this->accountConnector = $this->getMockBuilder('HWI\\Bundle\\OAuthBundle\\Connect\\AccountConnectorInterface')->getMock();
     $this->container->set('hwi_oauth.account.connector', $this->accountConnector);
     $this->oAuthUtils = $this->getMockBuilder('HWI\\Bundle\\OAuthBundle\\Security\\OAuthUtils')->disableOriginalConstructor()->getMock();
     $this->container->set('hwi_oauth.security.oauth_utils', $this->oAuthUtils);
     $this->userChecker = $this->getMockBuilder('Symfony\\Component\\Security\\Core\\User\\UserCheckerInterface')->getMock();
     $this->container->set('hwi_oauth.user_checker', $this->userChecker);
     $this->eventDispatcher = $this->getMockBuilder('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface')->getMock();
     $this->container->set('event_dispatcher', $this->eventDispatcher);
     $this->formFactory = $this->getMockBuilder('Symfony\\Component\\Form\\FormFactoryInterface')->getMock();
     $this->container->set('form.factory', $this->formFactory);
     $this->session = $this->getMockBuilder('Symfony\\Component\\HttpFoundation\\Session\\SessionInterface')->getMock();
     $this->request = Request::create('/');
     $this->request->setSession($this->session);
     $this->controller = new ConnectController();
     $this->controller->setContainer($this->container);
 }
 public function connectServiceAction(Request $request, $service)
 {
     $logger = $this->container->get('logger');
     $logger->info('Entering connectServiceAction - with service: ' . $service);
     return parent::connectServiceAction($request, $service);
 }