Author: Chuck "MANCHUCK" Reeves (chuck@manchuck.com)
Inheritance: implements Zend\ServiceManager\FactoryInterface
 public function testInstanceCreatedWithMongoDbInServiceLocator()
 {
     $this->services->setService('Configuration', array('zf-oauth2' => array('mongo' => array('locator_name' => 'testdb'))));
     $mock = $this->getMock('\\MongoDB', [], [], '', false);
     $this->services->setService('testdb', $mock);
     $adapter = $this->factory->createService($this->services);
     $this->assertInstanceOf('ZF\\OAuth2\\Adapter\\MongoAdapter', $adapter);
 }
 public function testCanPassAdapterConfigurationWhenCreatingInstance()
 {
     $this->services->setService('Config', array('zf-oauth2' => array('mongo' => array('locator_name' => 'testdb'), 'storage_settings' => array('user_table' => 'my_users'))));
     $mock = $this->getMock('\\MongoDB', array(), array(), '', false);
     $this->services->setService('testdb', $mock);
     $adapter = $this->factory->createService($this->services);
     $this->assertInstanceOf('ZF\\OAuth2\\Adapter\\MongoAdapter', $adapter);
     $r = new ReflectionObject($adapter);
     $c = $r->getProperty('config');
     $c->setAccessible(true);
     $config = $c->getValue($adapter);
     $this->assertEquals('my_users', $config['user_table']);
 }
 public function testCanPassAdapterConfigurationWhenCreatingInstance()
 {
     $this->services->setService('config', ['zf-oauth2' => ['mongo' => ['locator_name' => 'testdb'], 'storage_settings' => ['user_table' => 'my_users']]]);
     $mock = $this->getMockBuilder(MongoDB::class, [], [], '', false)->disableOriginalConstructor()->getMock();
     $this->services->setService('testdb', $mock);
     $adapter = $this->factory->createService($this->services);
     $this->assertInstanceOf('ZF\\OAuth2\\Adapter\\MongoAdapter', $adapter);
     $r = new ReflectionObject($adapter);
     $c = $r->getProperty('config');
     $c->setAccessible(true);
     $config = $c->getValue($adapter);
     $this->assertEquals('my_users', $config['user_table']);
 }