99
1010use Joomla \Application \WebApplicationInterface ;
1111use Joomla \Http \Http ;
12+ use Joomla \Http \Response ;
1213use Joomla \Input \Input ;
1314use Joomla \OAuth2 \Client ;
1415use Joomla \Registry \Registry ;
@@ -34,7 +35,7 @@ class ClientTest extends TestCase
3435 *
3536 * @var Http|MockObject
3637 */
37- protected $ client ;
38+ protected $ http ;
3839
3940 /**
4041 * The input object to use in retrieving GET/POST data.
@@ -348,11 +349,7 @@ public function testRefreshTokenJson()
348349 */
349350 public function encodedGrantOauthCallback ($ url , $ data , ?array $ headers = null , $ timeout = null )
350351 {
351- $ response = new \stdClass ();
352-
353- $ response ->code = 200 ;
354- $ response ->headers = ['Content-Type ' => 'x-www-form-urlencoded ' ];
355- $ response ->body = 'access_token=accessvalue&refresh_token=refreshvalue&expires_in=3600 ' ;
352+ $ response = new Response ('data://text/plain,access_token=accessvalue&refresh_token=refreshvalue&expires_in=3600 ' , 200 , ['Content-Type ' => 'x-www-form-urlencoded ' ]);
356353
357354 return $ response ;
358355 }
@@ -369,11 +366,7 @@ public function encodedGrantOauthCallback($url, $data, ?array $headers = null, $
369366 */
370367 public function jsonGrantOauthCallback ($ url , $ data , ?array $ headers = null , $ timeout = null )
371368 {
372- $ response = new \stdClass ();
373-
374- $ response ->code = 200 ;
375- $ response ->headers = ['Content-Type ' => 'application/json ' ];
376- $ response ->body = '{"access_token":"accessvalue","refresh_token":"refreshvalue","expires_in":3600} ' ;
369+ $ response = new Response ('data://text/plain,{"access_token":"accessvalue","refresh_token":"refreshvalue","expires_in":3600} ' , 200 , ['Content-Type ' => 'application/json ' ]);
377370
378371 return $ response ;
379372 }
@@ -390,11 +383,7 @@ public function jsonGrantOauthCallback($url, $data, ?array $headers = null, $tim
390383 */
391384 public function queryOauthCallback ($ url , $ data , ?array $ headers = null , $ timeout = null )
392385 {
393- $ response = new \stdClass ();
394-
395- $ response ->code = 200 ;
396- $ response ->headers = ['Content-Type ' => 'text/html ' ];
397- $ response ->body = 'Lorem ipsum dolor sit amet. ' ;
386+ $ response = new Response ('data://text/plain,Lorem ipsum dolor sit amet. ' , 200 , ['Content-Type ' => 'text/html ' ]);
398387
399388 return $ response ;
400389 }
@@ -410,11 +399,7 @@ public function queryOauthCallback($url, $data, ?array $headers = null, $timeout
410399 */
411400 public function getOauthCallback ($ url , ?array $ headers = null , $ timeout = null )
412401 {
413- $ response = new \stdClass ();
414-
415- $ response ->code = 200 ;
416- $ response ->headers = ['Content-Type ' => 'text/html ' ];
417- $ response ->body = 'Lorem ipsum dolor sit amet. ' ;
402+ $ response = new Response ('data://text/plain,Lorem ipsum dolor sit amet. ' , 200 , ['Content-Type ' => 'text/html ' ]);
418403
419404 return $ response ;
420405 }
0 commit comments