From 87dfbacbbd156dc6f648f874781a0780704ba3c4 Mon Sep 17 00:00:00 2001 From: David Buchmann Date: Tue, 9 Dec 2025 11:59:18 +0100 Subject: [PATCH] upgrade to integration tests 4 --- .github/workflows/ci.yml | 2 ++ composer.json | 4 ++-- src/Client.php | 12 ++++++------ tests/SocketHttpClientTest.php | 7 ++++--- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1231aa2..444a924 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,6 +24,7 @@ jobs: needs: - supported-versions-matrix strategy: + fail-fast: false matrix: php: ${{ fromJson(needs.supported-versions-matrix.outputs.version) }} @@ -56,6 +57,7 @@ jobs: needs: - supported-versions-matrix strategy: + fail-fast: false matrix: php: ${{ fromJson(needs.supported-versions-matrix.outputs.version) }} diff --git a/composer.json b/composer.json index 0689754..937f376 100644 --- a/composer.json +++ b/composer.json @@ -18,10 +18,10 @@ }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.51", - "php-http/client-integration-tests": "^3.1.1", + "php-http/client-integration-tests": "dev-cleanup-major", "php-http/message": "^1.16", "php-http/client-common": "^2.7", - "phpunit/phpunit": "^8.5.23 || ~9.5", + "phpunit/phpunit": "^10.0 || ^11.0 || ^12.0", "php-http/message-factory": "^1.1" }, "provide": { diff --git a/src/Client.php b/src/Client.php index 116b621..d8626d7 100644 --- a/src/Client.php +++ b/src/Client.php @@ -28,16 +28,16 @@ class Client implements HttpClient use ResponseReader; /** - * @var array{remote_socket: string|null, timeout: int, stream_context: resource, stream_context_options: array, stream_context_param: array, ssl: ?boolean, write_buffer_size: int, ssl_method: int} + * @var array{remote_socket: string|null, timeout: int, stream_context: resource, stream_context_options: array, stream_context_param: array, ssl: ?bool, write_buffer_size: int, ssl_method: int} */ private $config; /** * Constructor. * - * @param array{remote_socket?: string|null, timeout?: int, stream_context?: resource, stream_context_options?: array, stream_context_param?: array, ssl?: ?boolean, write_buffer_size?: int, ssl_method?: int}|ResponseFactoryInterface $config1 - * @param array{remote_socket?: string|null, timeout?: int, stream_context?: resource, stream_context_options?: array, stream_context_param?: array, ssl?: ?boolean, write_buffer_size?: int, ssl_method?: int}|null $config2 Mistake when refactoring the constructor from version 1 to version 2 - used as $config if set and $configOrResponseFactory is a response factory instance - * @param array{remote_socket?: string|null, timeout?: int, stream_context?: resource, stream_context_options?: array, stream_context_param?: array, ssl?: ?boolean, write_buffer_size?: int, ssl_method?: int} $config intended for version 1 BC, used as $config if $config2 is not set and $configOrResponseFactory is a response factory instance + * @param array{remote_socket?: string|null, timeout?: int, stream_context?: resource, stream_context_options?: array, stream_context_param?: array, ssl?: ?bool, write_buffer_size?: int, ssl_method?: int}|ResponseFactoryInterface $config1 + * @param array{remote_socket?: string|null, timeout?: int, stream_context?: resource, stream_context_options?: array, stream_context_param?: array, ssl?: ?bool, write_buffer_size?: int, ssl_method?: int}|null $config2 Mistake when refactoring the constructor from version 1 to version 2 - used as $config if set and $configOrResponseFactory is a response factory instance + * @param array{remote_socket?: string|null, timeout?: int, stream_context?: resource, stream_context_options?: array, stream_context_param?: array, ssl?: ?bool, write_buffer_size?: int, ssl_method?: int} $config intended for version 1 BC, used as $config if $config2 is not set and $configOrResponseFactory is a response factory instance * * string|null remote_socket Remote entrypoint (can be a tcp or unix domain address) * int timeout Timeout before canceling request @@ -141,9 +141,9 @@ protected function closeSocket($socket) /** * Return configuration for the socket client. * - * @param array{remote_socket?: string|null, timeout?: int, stream_context?: resource, stream_context_options?: array, stream_context_param?: array, ssl?: ?boolean, write_buffer_size?: int, ssl_method?: int} $config + * @param array{remote_socket?: string|null, timeout?: int, stream_context?: resource, stream_context_options?: array, stream_context_param?: array, ssl?: ?bool, write_buffer_size?: int, ssl_method?: int} $config * - * @return array{remote_socket: string|null, timeout: int, stream_context: resource, stream_context_options: array, stream_context_param: array, ssl: ?boolean, write_buffer_size: int, ssl_method: int} + * @return array{remote_socket: string|null, timeout: int, stream_context: resource, stream_context_options: array, stream_context_param: array, ssl: ?bool, write_buffer_size: int, ssl_method: int} */ protected function configure(array $config = []) { diff --git a/tests/SocketHttpClientTest.php b/tests/SocketHttpClientTest.php index 657f2ff..de3a1b0 100644 --- a/tests/SocketHttpClientTest.php +++ b/tests/SocketHttpClientTest.php @@ -7,15 +7,16 @@ use Http\Client\Socket\Exception\NetworkException; use Http\Client\Socket\Exception\TimeoutException; use Nyholm\Psr7\Factory\Psr17Factory; +use Psr\Http\Message\ResponseInterface; class SocketHttpClientTest extends BaseTestCase { - public function createClient($options = []) + public function createClient($options = []): HttpMethodsClient { return new HttpMethodsClient(new SocketHttpClient($options), new Psr17Factory()); } - public function testTcpSocketDomain() + public function testTcpSocketDomain(): void { $this->startServer('tcp-server'); $client = $this->createClient(['remote_socket' => '127.0.0.1:19999']); @@ -73,7 +74,7 @@ public function testSslRemoteInUri(): void ]); $response = $client->get('/', []); - $this->assertInstanceOf('Psr\Http\Message\ResponseInterface', $response); + $this->assertInstanceOf(ResponseInterface::class, $response); $this->assertEquals(200, $response->getStatusCode()); }