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 testGetLogoutRedirectsToLoginRoute() { $authenticationServiceMock = $this->getMock('Zend\\Authentication\\AuthenticationServiceInterface'); $controller = new LogoutController($authenticationServiceMock); $controller->setLoginRoute('my-crazy-login-route'); $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); }