Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
17 changes: 16 additions & 1 deletion tests/AbstractTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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);
}
}
Loading