*/ class IdentityProviderServiceFactoryTest extends PHPUnit_Framework_TestCase { /** * @covers \BjyAuthorize\Service\IdentityProviderServiceFactory::createService */ public function testCreateService() { $factory = new IdentityProviderServiceFactory(); $serviceLocator = $this->getMock('Zend\\ServiceManager\\ServiceLocatorInterface'); $identityProvider = $this->getMock('BjyAuthorize\\Provider\\Identity\\ProviderInterface'); $config = array('identity_provider' => 'foo'); $serviceLocator ->expects($this->any()) ->method('get') ->will($this->returnCallback(function ($serviceName) use ($identityProvider, $config) { if ('BjyAuthorize\\Config' === $serviceName) { return $config; } if ('foo' === $serviceName) { return $identityProvider; } throw new \InvalidArgumentException(); })); $this->assertSame($identityProvider, $factory->createService($serviceLocator)); } }