/**
  * @covers \ZfcUser\Authentication\Adapter\AdapterChainServiceFactory::createService
  */
 public function testCreateService()
 {
     $this->options->expects($this->once())->method('getAuthAdapters')->will($this->returnValue(array()));
     $this->markTestIncomplete('Test needs to check inside attach adapter loop');
     $adapterChain = $this->factory->createService($this->serviceLocator);
     $this->assertInstanceOf('ZfcUser\\Authentication\\Adapter\\AdapterChain', $adapterChain);
 }
 /**
  * @covers \ZfcUser\Authentication\Adapter\AdapterChainServiceFactory::createService
  */
 public function testCreateService()
 {
     $adapter = array('adapter1' => $this->getMock('ZfcUser\\Authentication\\Adapter\\AbstractAdapter', array('authenticate', 'logout')), 'adapter2' => $this->getMock('ZfcUser\\Authentication\\Adapter\\AbstractAdapter', array('authenticate', 'logout')));
     $adapterNames = array(100 => 'adapter1', 200 => 'adapter2');
     $this->serviceLocatorArray = array_merge($this->serviceLocatorArray, $adapter);
     $this->options->expects($this->once())->method('getAuthAdapters')->will($this->returnValue($adapterNames));
     $adapterChain = $this->factory->createService($this->serviceLocator);
     $this->assertInstanceOf('ZfcUser\\Authentication\\Adapter\\AdapterChain', $adapterChain);
     $this->assertEquals(array('authenticate', 'logout'), $adapterChain->getEventManager()->getEvents());
 }
 public function createService(ServiceLocatorInterface $services)
 {
     $factory = new AdapterChainServiceFactory();
     $chain = $factory->createService($services);
     $adapter = $services->get('ScnSocialAuth\\Authentication\\Adapter\\HybridAuth');
     $chain->getEventManager()->attach('authenticate', array($adapter, 'authenticate'), 1000);
     return $chain;
 }
 public function createService(ServiceLocatorInterface $services)
 {
     // Temporarily replace the adapters in the module options with the HybridAuth adapter
     $zfcUserModuleOptions = $services->get('zfcuser_module_options');
     $currentAuthAdapters = $zfcUserModuleOptions->getAuthAdapters();
     $zfcUserModuleOptions->setAuthAdapters(array(100 => 'ScnSocialAuth\\Authentication\\Adapter\\HybridAuth'));
     // Create a new adapter chain with HybridAuth adapter
     $factory = new AdapterChainServiceFactory();
     $chain = $factory->createService($services);
     // Reset the adapters in the module options
     $zfcUserModuleOptions->setAuthAdapters($currentAuthAdapters);
     return $chain;
 }