public function testHandleResponse() { $listener = new OAuthListener($this->securityContext, $this->authManager, $this->serverService); $this->serverService->expects($this->once())->method('getBearerToken')->will($this->returnValue('a-token')); $response = $this->getMock('Symfony\\Component\\HttpFoundation\\Response'); $this->authManager->expects($this->once())->method('authenticate')->will($this->returnValue($response)); $this->securityContext->expects($this->never())->method('setToken'); $this->event->expects($this->once())->method('setResponse')->will($this->returnArgument(0)); $ret = $listener->handle($this->event); $this->assertEquals($response, $ret); }
/** * {@inheritdoc} */ public function handle(GetResponseEvent $event) { $apiMode = $this->factory->getParameter('api_mode'); if ($apiMode != 'oauth2') { return; } parent::handle($event); }
/** * {@inheritdoc} */ public function handle(GetResponseEvent $event) { parent::handle($event); }