Skip to content

Commit e58ae81

Browse files
committed
use response as result as it is expected
1 parent 0fbe0b4 commit e58ae81

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

Tests/ClientTest.php

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
use Joomla\Application\WebApplicationInterface;
1111
use Joomla\Http\Http;
12+
use Joomla\Http\Response;
1213
use Joomla\Input\Input;
1314
use Joomla\OAuth2\Client;
1415
use Joomla\Registry\Registry;
@@ -348,11 +349,11 @@ public function testRefreshTokenJson()
348349
*/
349350
public function encodedGrantOauthCallback($url, $data, ?array $headers = null, $timeout = null)
350351
{
351-
$response = new \stdClass();
352+
$code = 200;
353+
$headers = ['Content-Type' => 'x-www-form-urlencoded'];
354+
$body = 'access_token=accessvalue&refresh_token=refreshvalue&expires_in=3600';
352355

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';
356+
$response = new Response($body, $code, $headers);
356357

357358
return $response;
358359
}
@@ -369,11 +370,11 @@ public function encodedGrantOauthCallback($url, $data, ?array $headers = null, $
369370
*/
370371
public function jsonGrantOauthCallback($url, $data, ?array $headers = null, $timeout = null)
371372
{
372-
$response = new \stdClass();
373+
$code = 200;
374+
$headers = ['Content-Type' => 'application/json'];
375+
$body = '{"access_token":"accessvalue","refresh_token":"refreshvalue","expires_in":3600}';
373376

374-
$response->code = 200;
375-
$response->headers = ['Content-Type' => 'application/json'];
376-
$response->body = '{"access_token":"accessvalue","refresh_token":"refreshvalue","expires_in":3600}';
377+
$response = new Response($body, $code, $headers);
377378

378379
return $response;
379380
}
@@ -390,11 +391,11 @@ public function jsonGrantOauthCallback($url, $data, ?array $headers = null, $tim
390391
*/
391392
public function queryOauthCallback($url, $data, ?array $headers = null, $timeout = null)
392393
{
393-
$response = new \stdClass();
394+
$code = 200;
395+
$headers = ['Content-Type' => 'text/html'];
396+
$body = 'Lorem ipsum dolor sit amet.';
394397

395-
$response->code = 200;
396-
$response->headers = ['Content-Type' => 'text/html'];
397-
$response->body = 'Lorem ipsum dolor sit amet.';
398+
$response = new Response($body, $code, $headers);
398399

399400
return $response;
400401
}
@@ -410,11 +411,11 @@ public function queryOauthCallback($url, $data, ?array $headers = null, $timeout
410411
*/
411412
public function getOauthCallback($url, ?array $headers = null, $timeout = null)
412413
{
413-
$response = new \stdClass();
414+
$code = 200;
415+
$headers = ['Content-Type' => 'text/html'];
416+
$body = 'Lorem ipsum dolor sit amet.';
414417

415-
$response->code = 200;
416-
$response->headers = ['Content-Type' => 'text/html'];
417-
$response->body = 'Lorem ipsum dolor sit amet.';
418+
$response = new Response($body, $code, $headers);
418419

419420
return $response;
420421
}

0 commit comments

Comments
 (0)