@@ -43,8 +43,6 @@ abstract class OAuth2ProviderTestAbstract extends ProviderTestAbstract{
4343 '/oauth2/api/request/test/get ' => ['foo ' ],
4444 ];
4545
46- protected $ authMethodHeader = OAuth2Interface::AUTH_METHODS_HEADER [OAuth2Interface::HEADER_BEARER ];
47-
4846 protected function setUp (){
4947 parent ::setUp ();
5048
@@ -93,7 +91,7 @@ public function testGetAccessToken(){
9391 public function testParseTokenResponseNoData (){
9492 $ this
9593 ->getMethod ('parseTokenResponse ' )
96- ->invokeArgs ($ this ->provider , [(new Response )->withBody (Psr17 \create_stream_from_input ('whatever ' ))])
94+ ->invokeArgs ($ this ->provider , [(new Response )->withBody (Psr17 \create_stream_from_input ('' ))])
9795 ;
9896 }
9997
@@ -123,12 +121,17 @@ public function testGetRequestAuthorization(){
123121 $ request = new Request ('GET ' , 'https://foo.bar ' );
124122 $ token = new AccessToken (['accessTokenSecret ' => 'test_token_secret ' , 'accessToken ' => 'test_token ' ]);
125123
126- // header (default)
127- $ this ->assertContains ($ this ->authMethodHeader .'test_token ' , $ this ->provider ->getRequestAuthorization ($ request , $ token )->getHeaderLine ('Authorization ' ));
124+ $ authMethod = $ this ->getProperty ('authMethod ' )->getValue ($ this ->provider );
128125
126+ // header (default)
127+ if (isset (OAuth2Interface::AUTH_METHODS_HEADER [$ authMethod ])){
128+ $ this ->assertContains (OAuth2Interface::AUTH_METHODS_HEADER [$ authMethod ].'test_token ' , $ this ->provider ->getRequestAuthorization ($ request , $ token )->getHeaderLine ('Authorization ' ));
129+ }
129130 // query
130- $ this ->setProperty ($ this ->provider , 'authMethod ' , OAuth2Interface::QUERY_ACCESS_TOKEN );
131- $ this ->assertContains ('access_token=test_token ' , $ this ->provider ->getRequestAuthorization ($ request , $ token )->getUri ()->getQuery ());
131+ elseif (isset (OAuth2Interface::AUTH_METHODS_QUERY [$ authMethod ])){
132+ $ this ->assertContains (OAuth2Interface::AUTH_METHODS_QUERY [$ authMethod ].'=test_token ' , $ this ->provider ->getRequestAuthorization ($ request , $ token )->getUri ()->getQuery ());
133+ }
134+
132135 }
133136
134137 public function testRequest (){
0 commit comments