public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $serviceManager = $serviceLocator->getServiceLocator();
     $authenticationService = $serviceManager->get('UghAuthentication\\Authentication\\AuthenticationService');
     $moduleOptions = $serviceLocator->getServiceLocator()->get('UghAuthentication\\Options\\ModuleOptions');
     $controller = new LogoutController($authenticationService);
     $controller->setLoginRoute($moduleOptions->getLoginRoute());
     return $controller;
 }
 public function testGetLogoutClearsExistingIdentityAndRedirectsToLoginRoute()
 {
     $this->identityExists = true;
     $authenticationServiceMock = $this->getMock('Zend\\Authentication\\AuthenticationServiceInterface');
     $authenticationServiceMock->expects($this->once())->method('clearIdentity');
     $controller = new LogoutController($authenticationServiceMock);
     $pluginManagerMock = $this->getMock('Zend\\Mvc\\Controller\\PluginManager', array('get'));
     $pluginManagerMock->expects($this->any())->method('get')->will($this->returnCallback(array($this, 'getPluginMockCallback')));
     $controller->setPluginManager($pluginManagerMock);
     $result = $controller->indexAction();
     $this->assertInstanceOf('Zend\\Http\\Response', $result);
 }