diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index eb9acb7..90dbcaf 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -37,6 +37,11 @@ jobs: restore-keys: | ${{ runner.os }}-${{ matrix.setup }}-php-${{ matrix.php }}- + - name: Add fig/http-message-util + if: matrix.setup == 'lowest' && matrix.php == '7.1' + run: | + composer require "fig/http-message-util:^1.1.5" --no-update + - name: Install dependencies if: steps.composer-cache.outputs.cache-hit != 'true' run: | diff --git a/composer.json b/composer.json index 859b71e..2ced1b1 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ "slim/slim": "^3.12.5 || ^4.15.1", "slim/psr7": "*", "php-di/php-di": "^5.4.6 || ^6.4", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^8.5.15" + "phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^8.5.52" }, "autoload": { "psr-4": { diff --git a/tests/AbstractTestCase.php b/tests/AbstractTestCase.php index 4f9652a..3b3fa1c 100644 --- a/tests/AbstractTestCase.php +++ b/tests/AbstractTestCase.php @@ -15,6 +15,7 @@ use Slim\Http\Uri as Slim3Uri; use Slim\Psr7\Headers; use Slim\Psr7\Request; +use Slim\Psr7\Response; use Slim\Psr7\Stream; use Slim\Psr7\Uri; use Slim\Pug\PugRenderer; @@ -116,7 +117,7 @@ protected function fetch(string $path): string // Slim 4 if (class_exists(Headers::class)) { // Run App & Emit Response - $response = $app->handle(new Request( + $response = $this->getResponse($app, new Request( 'GET', new Uri('https', 'domain.com', 443, $path), new Headers(), @@ -164,4 +165,18 @@ private function getContents(string $path, string $file): string return $contents; } + + private function getResponse(App $app, Request $request): Response + { + if (!method_exists($app, 'handle')) { + error_reporting(E_ALL ^ E_DEPRECATED); + $response = new Response(); + $app->process($request, $response); + + return $response; + } + + // Run App & Emit Response + return $app->handle($request); + } }