Skip to content

Commit

Permalink
fix: use ResponseInterface instead of Response in ControllerTestTrait
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Sep 23, 2022
1 parent ef3707f commit ef27f71
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions system/Test/ControllerTestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use CodeIgniter\HTTP\Exceptions\HTTPException;
use CodeIgniter\HTTP\IncomingRequest;
use CodeIgniter\HTTP\Response;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\HTTP\URI;
use Config\App;
use Config\Services;
Expand Down Expand Up @@ -55,7 +56,7 @@ trait ControllerTestTrait
/**
* Response.
*
* @var Response
* @var ResponseInterface
*/
protected $response;

Expand Down Expand Up @@ -177,7 +178,7 @@ public function execute(string $method, ...$params)
}

// If the controller did not return a response then start one
if (! $response instanceof Response) {
if (! $response instanceof ResponseInterface) {
$response = $this->response;
}

Expand Down Expand Up @@ -244,7 +245,7 @@ public function withRequest($request)
/**
* Set controller's response, with method chaining.
*
* @param mixed $response
* @param ResponseInterface $response
*
* @return $this
*/
Expand Down
6 changes: 3 additions & 3 deletions system/Test/ControllerTester.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

use CodeIgniter\Controller;
use CodeIgniter\HTTP\IncomingRequest;
use CodeIgniter\HTTP\Response;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\HTTP\URI;
use Config\App;
use Config\Services;
Expand Down Expand Up @@ -58,7 +58,7 @@ trait ControllerTester
/**
* Response.
*
* @var Response
* @var ResponseInterface
*/
protected $response;

Expand Down Expand Up @@ -182,7 +182,7 @@ public function execute(string $method, ...$params)
$output = ob_get_clean();

// If the controller returned a response, use it
if (isset($response) && $response instanceof Response) {
if (isset($response) && $response instanceof ResponseInterface) {
$result->setResponse($response);
}

Expand Down

0 comments on commit ef27f71

Please sign in to comment.