diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 52990d0..91dc690 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,7 +32,7 @@ jobs: fail-fast: false matrix: package: ${{ fromJson(needs.matrix.outputs.list) }} - php: [ '8.1', '8.2', '8.3' ] + php: [ '8.1', '8.2', '8.3', '8.4', '8.5' ] strategy: [ 'highest', 'lowest' ] steps: diff --git a/composer.json b/composer.json index db0e2ea..f2d6c34 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ "clue/arguments": "^2.1", "guzzlehttp/psr7": "^1.8 || ^2.0", "illuminate/contracts": "^8.33", - "laminas/laminas-diactoros": "^2.5", + "laminas/laminas-diactoros": "^2.5 || ^3.0", "laminas/laminas-httphandlerrunner": "^1.5 || ^2.9", "nyholm/psr7": "^1.3", "nyholm/psr7-server": "^1.0", @@ -23,12 +23,12 @@ "spiral/roadrunner-cli": "^2.6", "spiral/roadrunner-http": "^2.0 || ^3.0", "spiral/roadrunner-worker": "^2.0 || ^3.0", - "symfony/console": "^5.2 || ^6.0", - "symfony/dependency-injection": "^5.2 || ^6.0", - "symfony/http-foundation": "^5.3 || ^6.0", - "symfony/http-kernel": "^5.4 || ^6.0 || ^7.0", - "symfony/psr-http-message-bridge": "^2.1 || ^6.4 || ^7.0", - "symfony/runtime": "^5.3 || ^6.0" + "symfony/console": "^5.2 || ^6.0 || ^7.0 || ^8.0", + "symfony/dependency-injection": "^5.2 || ^6.0 || ^7.0 || ^8.0", + "symfony/http-foundation": "^5.3 || ^6.0 || ^7.0 || ^8.0", + "symfony/http-kernel": "^5.4 || ^6.0 || ^7.0 || ^8.0", + "symfony/psr-http-message-bridge": "^2.1 || ^6.4 || ^7.0 || ^8.0", + "symfony/runtime": "^5.3 || ^6.0 || ^7.0 || ^8.0" }, "require-dev": { "guzzlehttp/test-server": "^0.1", diff --git a/src/bref/composer.json b/src/bref/composer.json index 04cdbe4..2ae28a2 100644 --- a/src/bref/composer.json +++ b/src/bref/composer.json @@ -17,14 +17,14 @@ "psr/http-server-handler": "^1.0", "riverline/multipart-parser": "^2.0.9", "runtime/bref-layer": "^1.3", - "symfony/runtime": "^5.4 || ^6.0 || ^7.0" + "symfony/runtime": "^5.4 || ^6.0 || ^7.0 || ^8.0" }, "require-dev": { - "bref/bref": "^1.3", + "bref/bref": "^1.3 || 2.0", "guzzlehttp/test-server": "^0.1", - "phpunit/phpunit": "^9.5", - "symfony/http-foundation": "^5.4 || ^6.0 || ^7.0", - "symfony/http-kernel": "^5.4 || ^6.0 || ^7.0" + "phpunit/phpunit": "^10.5.58", + "symfony/http-foundation": "^5.4 || ^6.0 || ^7.0 || ^8.0", + "symfony/http-kernel": "^5.4 || ^6.0 || ^7.0 || ^8.0" }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/src/bref/tests/Lambda/LambdaClientTest.php b/src/bref/tests/Lambda/LambdaClientTest.php index 37d80cd..4f37c12 100644 --- a/src/bref/tests/Lambda/LambdaClientTest.php +++ b/src/bref/tests/Lambda/LambdaClientTest.php @@ -22,7 +22,26 @@ class LambdaClientTest extends TestCase protected function setUp(): void { ob_start(); - Server::start(); + + $maxRetries = 5; + $attempt = 0; + while ($attempt < $maxRetries) { + try { + Server::start(); + break; + } catch (\RuntimeException $runtimeException) { + if ('Unable to contact node.js server' !== $runtimeException->getMessage()) { + throw $runtimeException; + } + + ++$attempt; + if ($attempt >= $maxRetries) { + throw $runtimeException; + } + \usleep(500000); + } + } + $this->lambda = new LambdaClient('localhost:8126', 'phpunit'); } @@ -284,7 +303,7 @@ private function assertInvocationErrorResult(string $errorClass, string $errorMe private function assertErrorInLogs(string $errorClass, string $errorMessage): void { // Decode the logs from stdout - $stdout = $this->getActualOutput(); + $stdout = $this->getActualOutputForAssertion(); [$requestId, $message, $json] = explode("\t", $stdout); @@ -308,7 +327,7 @@ private function assertErrorInLogs(string $errorClass, string $errorMessage): vo private function assertPreviousErrorsInLogs(array $previousErrors) { // Decode the logs from stdout - $stdout = $this->getActualOutput(); + $stdout = $this->getActualOutputForAssertion(); [, , $json] = explode("\t", $stdout); diff --git a/src/bref/tests/SymfonyRequestBridgeTest.php b/src/bref/tests/SymfonyRequestBridgeTest.php index 4943724..f4fda89 100644 --- a/src/bref/tests/SymfonyRequestBridgeTest.php +++ b/src/bref/tests/SymfonyRequestBridgeTest.php @@ -61,8 +61,7 @@ public function testRawContent() rfc ------------------------------83ff53821b7c-- -HTTP - , +HTTP, ]), $this->getContext()); $this->assertSame('', $request->getContent()); } @@ -90,8 +89,7 @@ public function testUploadedFile() bar ------------------------------83ff53821b7c-- -HTTP - , +HTTP, ]), $this->getContext()); $files = $request->files->all(); $this->assertArrayHasKey('img', $files['form']); @@ -124,8 +122,7 @@ public function testEmptyUploadedFile() bar ------------------------------83ff53821b7c-- -HTTP - , +HTTP, ]), $this->getContext()); $files = $request->files->all(); $this->assertArrayHasKey('img', $files['form']); diff --git a/src/frankenphp-symfony/composer.json b/src/frankenphp-symfony/composer.json index e389bf8..9caecbc 100644 --- a/src/frankenphp-symfony/composer.json +++ b/src/frankenphp-symfony/composer.json @@ -16,7 +16,7 @@ "symfony/runtime": "^5.4 || ^6.0 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "^9.5" + "phpunit/phpunit": "^10.5.58" }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/src/google-cloud/composer.json b/src/google-cloud/composer.json index a369f28..11913e9 100644 --- a/src/google-cloud/composer.json +++ b/src/google-cloud/composer.json @@ -12,10 +12,10 @@ "require": { "php": ">=8.0.5", "ext-json": "*", - "symfony/runtime": "^5.4 || ^6.0 || ^7.0" + "symfony/runtime": "^5.4 || ^6.0 || ^7.0 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^9.5" + "phpunit/phpunit": "^10.5.58" }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/src/laravel/composer.json b/src/laravel/composer.json index f85bd0f..c205c14 100644 --- a/src/laravel/composer.json +++ b/src/laravel/composer.json @@ -12,12 +12,12 @@ "require": { "php": ">=8.0.5", "illuminate/contracts": "^8.33", - "symfony/runtime": "^5.4 || ^6.0 || ^7.0" + "symfony/runtime": "^5.4 || ^6.0 || ^7.0 || ^8.0" }, "require-dev": { "illuminate/http": "^8.33", - "phpunit/phpunit": "^9.5", - "symfony/console": "^5.4 || ^6.0 || ^7.0" + "phpunit/phpunit": "^10.5.58", + "symfony/console": "^5.4 || ^6.0 || ^7.0 || ^8.0" }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/src/psr-17/composer.json b/src/psr-17/composer.json index 46198b7..0710024 100644 --- a/src/psr-17/composer.json +++ b/src/psr-17/composer.json @@ -14,11 +14,11 @@ "nyholm/psr7-server": "^1.0", "psr/http-factory-implementation": "^1.0", "psr/http-server-handler": "^1.0", - "symfony/runtime": "^5.4 || ^6.0 || ^7.0" + "symfony/runtime": "^5.4.46 || ^6.0 || ^7.0 || ^8.0" }, "require-dev": { "nyholm/psr7": "^1.4", - "phpunit/phpunit": "^9.5" + "phpunit/phpunit": "^10.5.58" }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/src/psr-guzzle/composer.json b/src/psr-guzzle/composer.json index cd19e76..86824c0 100644 --- a/src/psr-guzzle/composer.json +++ b/src/psr-guzzle/composer.json @@ -13,10 +13,10 @@ "php": ">=8.0.5", "guzzlehttp/psr7": "^1.8 || ^2.0", "psr/http-server-handler": "^1.0", - "symfony/runtime": "^5.4 || ^6.0 || ^7.0" + "symfony/runtime": "^5.4.46 || ^6.0 || ^7.0 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^9.5" + "phpunit/phpunit": "^10.5.58" }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/src/psr-laminas/composer.json b/src/psr-laminas/composer.json index 42ecaa3..ee16831 100644 --- a/src/psr-laminas/composer.json +++ b/src/psr-laminas/composer.json @@ -11,12 +11,12 @@ ], "require": { "php": ">=8.0.5", - "laminas/laminas-diactoros": "^2.5", + "laminas/laminas-diactoros": "^2.5 || ^3.0", "laminas/laminas-httphandlerrunner": "^1.5 || ^2.9", - "symfony/runtime": "^5.4 || ^6.0 || ^7.0" + "symfony/runtime": "^5.4.46 || ^6.0 || ^7.0 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^9.5" + "phpunit/phpunit": "^10.5.58" }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/src/psr-nyholm-laminas/composer.json b/src/psr-nyholm-laminas/composer.json index e6a31ba..5f401d2 100644 --- a/src/psr-nyholm-laminas/composer.json +++ b/src/psr-nyholm-laminas/composer.json @@ -14,10 +14,10 @@ "laminas/laminas-httphandlerrunner": "^1.5 || ^2.9", "nyholm/psr7": "^1.3", "nyholm/psr7-server": "^1.0", - "symfony/runtime": "^5.4 || ^6.0 || ^7.0" + "symfony/runtime": "^5.4.46 || ^6.0 || ^7.0 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^9.5" + "phpunit/phpunit": "^10.5.58" }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/src/psr-nyholm/composer.json b/src/psr-nyholm/composer.json index b0b8a99..6615952 100644 --- a/src/psr-nyholm/composer.json +++ b/src/psr-nyholm/composer.json @@ -14,10 +14,10 @@ "nyholm/psr7": "^1.3", "nyholm/psr7-server": "^1.0", "psr/http-server-handler": "^1.0", - "symfony/runtime": "^5.4 || ^6.0 || ^7.0" + "symfony/runtime": "^5.4.46 || ^6.0 || ^7.0 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^9.5" + "phpunit/phpunit": "^10.5.58" }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/src/reactphp/composer.json b/src/reactphp/composer.json index 12cbc0d..c813669 100644 --- a/src/reactphp/composer.json +++ b/src/reactphp/composer.json @@ -13,10 +13,10 @@ "php": ">=8.0.5", "psr/http-server-handler": "^1.0", "react/http": "^1.6", - "symfony/runtime": "^5.4 || ^6.0 || ^7.0" + "symfony/runtime": "^5.4 || ^6.0 || ^7.0 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^9.5" + "phpunit/phpunit": "^10.5.58" }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/src/roadrunner-nyholm/composer.json b/src/roadrunner-nyholm/composer.json index e5b0392..8681fd5 100644 --- a/src/roadrunner-nyholm/composer.json +++ b/src/roadrunner-nyholm/composer.json @@ -14,11 +14,11 @@ "spiral/roadrunner-cli": "^2.6", "spiral/roadrunner-http": "^2.0 || ^3.0", "spiral/roadrunner-worker": "^2.0 || ^3.0", - "symfony/runtime": "^5.4 || ^6.0 || ^7.0" + "symfony/runtime": "^5.4 || ^6.0 || ^7.0 || ^8.0" }, "require-dev": { "php": ">=8.0.5", - "phpunit/phpunit": "^9.5", + "phpunit/phpunit": "^10.5.58", "psr/http-server-handler": "^1.0" }, "minimum-stability": "dev", diff --git a/src/roadrunner-symfony-nyholm/composer.json b/src/roadrunner-symfony-nyholm/composer.json index 8c95e35..7941e39 100644 --- a/src/roadrunner-symfony-nyholm/composer.json +++ b/src/roadrunner-symfony-nyholm/composer.json @@ -15,14 +15,14 @@ "spiral/roadrunner-cli": "^2.6", "spiral/roadrunner-http": "^2.0 || ^3.0", "spiral/roadrunner-worker": "^2.0 || ^3.0", - "symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0", - "symfony/http-kernel": "^5.4 || ^6.0 || ^7.0", - "symfony/psr-http-message-bridge": "^2.1 || ^6.4 || ^7.0", - "symfony/runtime": "^5.4 || ^6.0 || ^7.0" + "symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0 || ^8.0", + "symfony/http-kernel": "^5.4 || ^6.0 || ^7.0 || ^8.0", + "symfony/psr-http-message-bridge": "^2.1 || ^6.4 || ^7.0 || ^8.0", + "symfony/runtime": "^5.4 || ^6.0 || ^7.0 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^9.5", - "symfony/console": "^5.4 || ^6.4 || ^7.0" + "phpunit/phpunit": "^10.5.58", + "symfony/console": "^5.4 || ^6.4 || ^7.0 || ^8.0" }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/src/swoole-nyholm/composer.json b/src/swoole-nyholm/composer.json index f0af16a..5b90441 100644 --- a/src/swoole-nyholm/composer.json +++ b/src/swoole-nyholm/composer.json @@ -13,10 +13,10 @@ "php": ">=8.1", "nyholm/psr7": "^1.7", "psr/http-server-handler": "^1.0", - "symfony/runtime": "^5.4.26 || ^6.3.2 || ^7.0" + "symfony/runtime": "^5.4.26 || ^6.3.2 || ^7.0 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^9.5" + "phpunit/phpunit": "^10.5.58" }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/src/swoole/composer.json b/src/swoole/composer.json index 96d247c..28cbe74 100644 --- a/src/swoole/composer.json +++ b/src/swoole/composer.json @@ -11,14 +11,14 @@ ], "require": { "php": ">=8.1", - "symfony/runtime": "^5.4.26 || ^6.3.2 || ^7.0" + "symfony/runtime": "^5.4.26 || ^6.3.2 || ^7.0 || ^8.0" }, "require-dev": { "illuminate/http": "^9.14", - "phpunit/phpunit": "^9.6.15", + "phpunit/phpunit": "^10.5.58", "swoole/ide-helper": "^4.6", - "symfony/http-foundation": "^5.4.32 || ^6.3.9 || ^7.0", - "symfony/http-kernel": "^5.4.33 || ^6.3.10 || ^7.0" + "symfony/http-foundation": "^5.4.32 || ^6.3.9 || ^7.0 || ^8.0", + "symfony/http-kernel": "^5.4.33 || ^6.3.10 || ^7.0 || ^8.0" }, "conflict": { "ext-swoole": "<4.6.0" diff --git a/src/swoole/tests/Unit/SymfonyHttpBridgeTest.php b/src/swoole/tests/Unit/SymfonyHttpBridgeTest.php index fa3ec36..f025dc5 100644 --- a/src/swoole/tests/Unit/SymfonyHttpBridgeTest.php +++ b/src/swoole/tests/Unit/SymfonyHttpBridgeTest.php @@ -72,11 +72,21 @@ public function testThatSymfonyResponseIsReflected(): void $sfResponse->expects(self::once())->method('getContent')->willReturn('Test'); $response = $this->createMock(Response::class); - $response->expects(self::exactly(3))->method('header')->withConsecutive( + $expectedHeaders = [ ['x-test', 'Swoole-Runtime'], ['set-cookie', $fooCookie], - ['set-cookie', $barCookie] - ); + ['set-cookie', $barCookie], + ]; + $callCount = 0; + $response->expects(self::exactly(3))->method('header') + ->willReturnCallback(function ($key, $value) use ($expectedHeaders, &$callCount) { + $this->assertArrayHasKey($callCount, $expectedHeaders); + $this->assertEquals($expectedHeaders[$callCount][0], $key); + $this->assertEquals($expectedHeaders[$callCount][1], $value); + ++$callCount; + + return true; + }); $response->expects(self::once())->method('status')->with(201); $response->expects(self::once())->method('end')->with('Test'); @@ -94,7 +104,19 @@ public function testThatSymfonyStreamedResponseIsReflected(): void }); $response = $this->createMock(Response::class); - $response->expects(self::exactly(3))->method('write')->withConsecutive(["Foo\n"], ["Bar\n"], ['']); + $expectedWrites = [ + "Foo\n", + "Bar\n", + '', + ]; + $callCount = 0; + $response->expects(self::exactly(3))->method('write') + ->willReturnCallback(function ($string) use ($expectedWrites, &$callCount) { + $this->assertEquals($expectedWrites[$callCount], $string); + ++$callCount; + + return true; + }); $response->expects(self::once())->method('end'); SymfonyHttpBridge::reflectSymfonyResponse($sfResponse, $response);