@@ -26,40 +26,8 @@ class DeezerTest extends OAuth2ProviderTestAbstract{
2626
2727 protected $ FQN = Deezer::class;
2828
29- protected $ responses = [
30- '/oauth2/access_token ' => [
31- 'access_token ' => 'test_access_token ' ,
32- 'expires ' => 3600 ,
33- 'state ' => 'test_state ' ,
34- ],
35- '/oauth2/refresh_token ' => [
36- 'access_token ' => 'test_refreshed_access_token ' ,
37- 'expires ' => 60 ,
38- 'state ' => 'test_state ' ,
39- ],
40- '/oauth2/client_credentials ' => [
41- 'access_token ' => 'test_client_credentials_token ' ,
42- 'expires ' => 30 ,
43- 'state ' => 'test_state ' ,
44- ],
45- '/oauth2/api/request ' => [
46- 'data ' => 'such data! much wow! '
47- ],
48- '/oauth2/api/request/test/get ' => ['foo ' ],
49- ];
50-
5129 protected function initHttp ():ClientInterface {
52- return new class ($ this ->reflection , $ this ->responses ) implements ClientInterface{
53-
54- /** @var \ReflectionClass */
55- protected $ reflection ;
56- /** @var array */
57- protected $ responses ;
58-
59- public function __construct (ReflectionClass $ reflection , array $ responses ){
60- $ this ->reflection = $ reflection ;
61- $ this ->responses = $ responses ;
62- }
30+ return new class ($ this ->responses , $ this ->logger ) extends ProviderTestHttpClient{
6331
6432 public function sendRequest (RequestInterface $ request ):ResponseInterface {
6533 $ path = $ request ->getUri ()->getPath ();
@@ -69,8 +37,9 @@ public function sendRequest(RequestInterface $request):ResponseInterface{
6937 ? json_encode ($ body )
7038 : http_build_query ($ body );
7139
72- return ( new Response )->withBody (Psr17 \create_stream_from_input ($ body ));
40+ return $ this -> logRequest ( $ request , ( new Response )->withBody (Psr17 \create_stream_from_input ($ body) ));
7341 }
42+
7443 };
7544 }
7645
0 commit comments