/** * @covers ZfcUser\Controller\Plugin\ZfcUserAuthentication::setAuthAdapter * @covers ZfcUser\Controller\Plugin\ZfcUserAuthentication::getAuthAdapter */ public function testSetAndGetAuthAdapter() { $adapter1 = $this->mockedAuthenticationAdapter; $adapter2 = new AdapterChain(); $this->SUT->setAuthAdapter($adapter1); $this->assertInstanceOf('\\Zend\\Authentication\\Adapter\\AdapterInterface', $this->SUT->getAuthAdapter()); $this->assertSame($adapter1, $this->SUT->getAuthAdapter()); $this->SUT->setAuthAdapter($adapter2); $this->assertInstanceOf('\\Zend\\Authentication\\Adapter\\AdapterInterface', $this->SUT->getAuthAdapter()); $this->assertNotSame($adapter1, $this->SUT->getAuthAdapter()); $this->assertSame($adapter2, $this->SUT->getAuthAdapter()); }
/** * {@inheritDoc} */ public function createService(ServiceLocatorInterface $plugins) { $serviceLocator = $plugins->getServiceLocator(); $controllerPlugin = new ZfcUserAuthentication(); $controllerPlugin->setAuthService($serviceLocator->get('zfcuser_auth_service')); $controllerPlugin->setAuthAdapter($serviceLocator->get('ZfcUser\\Authentication\\Adapter\\AdapterChain')); return $controllerPlugin; }
/** * Create service * * @param ServiceLocatorInterface $serviceManager * @return mixed */ public function createService(ServiceLocatorInterface $serviceManager) { $serviceLocator = $serviceManager->getServiceLocator(); $authService = $serviceLocator->get('zfcuser_auth_service'); $authAdapter = $serviceLocator->get('ZfcUser\\Authentication\\Adapter\\AdapterChain'); $controllerPlugin = new Controller\Plugin\ZfcUserAuthentication(); $controllerPlugin->setAuthService($authService); $controllerPlugin->setAuthAdapter($authAdapter); return $controllerPlugin; }
public function getControllerPluginConfig() { return array('factories' => array('zfcUserAuthentication' => function ($sm) { $serviceLocator = $sm->getServiceLocator(); $authService = $serviceLocator->get('zfcuser_auth_service'); $authAdapter = $serviceLocator->get('ZfcUser\\Authentication\\Adapter\\AdapterChain'); $controllerPlugin = new Controller\Plugin\ZfcUserAuthentication(); $controllerPlugin->setAuthService($authService); $controllerPlugin->setAuthAdapter($authAdapter); return $controllerPlugin; })); }