public function testExtractAccessToken()
 {
     $def = new SecurityDefinition();
     $def->setAuthorizationUrl('http://test.com/auth')->setDescription('some description...')->setFlow('password')->setType('oauth2')->setName('Authorization')->setIn('header')->setTokenUrl('http://test.com/token')->setScopes(array());
     $request = new Request();
     $request->headers->set('Authorization', 'Bearer 12345');
     $this->assertEquals('Bearer 12345', $def->extractAccessToken($request));
     $def->setIn('query');
     $this->assertEquals(null, $def->extractAccessToken($request));
     $def->setIn('header')->setName('x-auth');
     $this->assertEquals(null, $def->extractAccessToken($request));
     $def = new SecurityDefinition();
     $def->setAuthorizationUrl('http://test.com/auth')->setDescription('some description...')->setFlow('password')->setType('oauth2')->setName('Authorization')->setIn('header')->setTokenUrl('http://test.com/token')->setScopes(array());
     $request = new Request(array('Authorization' => 'Bearer 12345'));
     $this->assertEquals(null, $def->extractAccessToken($request));
     $def->setIn('query');
     $this->assertEquals('Bearer 12345', $def->extractAccessToken($request));
     $def->setName('x-auth');
     $this->assertEquals(null, $def->extractAccessToken($request));
 }
 public function setUp()
 {
     $def = new SecurityDefinition();
     $def->setAuthorizationUrl('http://test.com/auth')->setDescription('some description...')->setFlow('password')->setType('oauth2')->setName('Authorization')->setIn('header')->setTokenUrl('http://test.com/token')->setScopes(array());
     $this->authenticator = new ApiAuthenticator($def);
 }