From ef27f716df9248cd5e2b4f53cd7119914303755d Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 23 Sep 2022 10:46:03 +0900 Subject: [PATCH] fix: use ResponseInterface instead of Response in ControllerTestTrait --- system/Test/ControllerTestTrait.php | 7 ++++--- system/Test/ControllerTester.php | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/system/Test/ControllerTestTrait.php b/system/Test/ControllerTestTrait.php index 6a784eb8c7e9..5a4f68604ea9 100644 --- a/system/Test/ControllerTestTrait.php +++ b/system/Test/ControllerTestTrait.php @@ -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; @@ -55,7 +56,7 @@ trait ControllerTestTrait /** * Response. * - * @var Response + * @var ResponseInterface */ protected $response; @@ -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; } @@ -244,7 +245,7 @@ public function withRequest($request) /** * Set controller's response, with method chaining. * - * @param mixed $response + * @param ResponseInterface $response * * @return $this */ diff --git a/system/Test/ControllerTester.php b/system/Test/ControllerTester.php index 67b5e01e782e..a4b41a94c308 100644 --- a/system/Test/ControllerTester.php +++ b/system/Test/ControllerTester.php @@ -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; @@ -58,7 +58,7 @@ trait ControllerTester /** * Response. * - * @var Response + * @var ResponseInterface */ protected $response; @@ -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); }