@@ -43,8 +43,6 @@ abstract class OAuth2ProviderTestAbstract extends ProviderTestAbstract{
43
43
'/oauth2/api/request/test/get ' => ['foo ' ],
44
44
];
45
45
46
- protected $ authMethodHeader = OAuth2Interface::AUTH_METHODS_HEADER [OAuth2Interface::HEADER_BEARER ];
47
-
48
46
protected function setUp (){
49
47
parent ::setUp ();
50
48
@@ -93,7 +91,7 @@ public function testGetAccessToken(){
93
91
public function testParseTokenResponseNoData (){
94
92
$ this
95
93
->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 ('' ))])
97
95
;
98
96
}
99
97
@@ -123,12 +121,17 @@ public function testGetRequestAuthorization(){
123
121
$ request = new Request ('GET ' , 'https://foo.bar ' );
124
122
$ token = new AccessToken (['accessTokenSecret ' => 'test_token_secret ' , 'accessToken ' => 'test_token ' ]);
125
123
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 );
128
125
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
+ }
129
130
// 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
+
132
135
}
133
136
134
137
public function testRequest (){
0 commit comments