/** * Create service * * @param ServiceLocatorInterface $serviceLocator * @return mixed */ public function createService(ServiceLocatorInterface $serviceLocator) { $topLevelIdentityProvider = new ChainedIdentityProvider(); $identityProviderServices = ['Aeris\\ZfAuth\\IdentityProvider\\OAuthUserIdentityProvider', 'Aeris\\ZfAuth\\IdentityProvider\\OAuthClientIdentityProvider', 'Aeris\\ZfAuth\\IdentityProvider\\AnonymousIdentityProvider']; $providers = array_map([$serviceLocator, 'get'], $identityProviderServices); $topLevelIdentityProvider->setProviders($providers); return $topLevelIdentityProvider; }
/** @test */ public function getIdentity_shouldReturnNullWhenNoProviders() { $provider = new ChainedIdentityProvider([]); $this->assertEquals(null, $provider->getIdentity()); }