public function testControllerCreated() { $oauthServer = $this->getMockBuilder('OAuth2\\Server')->disableOriginalConstructor()->getMock(); $this->services->setService('ZF\\OAuth2\\Service\\OAuth2Server', $oauthServer); $controller = $this->factory->createService($this->controllers); $this->assertInstanceOf('ZF\\OAuth2\\Controller\\AuthController', $controller); $this->assertEquals(new \ZF\OAuth2\Controller\AuthController($oauthServer), $controller); }
public function testControllerCreated() { $adapter = $this->getMockBuilder('OAuth2\\Storage\\Pdo')->disableOriginalConstructor()->getMock(); $this->services->setService('TestAdapter', $adapter); $this->services->setService('Configuration', array('zf-oauth2' => array('storage' => 'TestAdapter'))); $controller = $this->factory->createService($this->controllers); $this->assertInstanceOf('ZF\\OAuth2\\Controller\\AuthController', $controller); }
public function testControllerCreated() { $oauthServerFactory = function () { }; $this->services->setService('ZF\\OAuth2\\Service\\OAuth2Server', $oauthServerFactory); $userIdProvider = $this->getMock('ZF\\OAuth2\\Provider\\UserId\\UserIdProviderInterface'); $this->services->setService('ZF\\OAuth2\\Provider\\UserId', $userIdProvider); $controller = $this->factory->createService($this->controllers); $this->assertInstanceOf('ZF\\OAuth2\\Controller\\AuthController', $controller); $this->assertEquals(new AuthController($oauthServerFactory, $userIdProvider), $controller); }
public function testControllerCreated() { $oauthServerFactory = function () { }; $this->services->setService('ZF\\OAuth2\\Service\\OAuth2Server', $oauthServerFactory); $userIdProvider = $this->getMockBuilder('ZF\\OAuth2\\Provider\\UserId\\UserIdProviderInterface')->getMock(); $this->services->setService('ZF\\OAuth2\\Provider\\UserId', $userIdProvider); $controller = $this->isV2ServiceManager($this->services) ? $controller = $this->factory->createService($this->controllers) : ($controller = $this->factory->__invoke($this->services, AuthController::class)); $this->assertInstanceOf('ZF\\OAuth2\\Controller\\AuthController', $controller); $this->assertEquals(new AuthController($oauthServerFactory, $userIdProvider), $controller); }