diff --git a/Tests/CurlHttpClientTest.php b/Tests/CurlHttpClientTest.php index 94f4455..e73e2b6 100644 --- a/Tests/CurlHttpClientTest.php +++ b/Tests/CurlHttpClientTest.php @@ -38,8 +38,7 @@ protected function getHttpClient(string $testCase): HttpClientInterface public function testBindToPort() { $client = $this->getHttpClient(__FUNCTION__); - $localhost = gethostbyname('localhost'); - $response = $client->request('GET', "http://$localhost:8057", ['bindto' => "$localhost:9876"]); + $response = $client->request('GET', 'http://localhost:8057', ['bindto' => '127.0.0.1:9876']); $response->getStatusCode(); $r = new \ReflectionProperty($response, 'handle'); @@ -47,7 +46,7 @@ public function testBindToPort() $curlInfo = curl_getinfo($r->getValue($response)); - self::assertSame($localhost, $curlInfo['local_ip']); + self::assertSame('127.0.0.1', $curlInfo['local_ip']); self::assertSame(9876, $curlInfo['local_port']); } diff --git a/Tests/HttpClientTestCase.php b/Tests/HttpClientTestCase.php index c4fb1f0..d5296e1 100644 --- a/Tests/HttpClientTestCase.php +++ b/Tests/HttpClientTestCase.php @@ -298,15 +298,13 @@ private static function startVulcain(HttpClientInterface $client) self::markTestSkipped('Testing with the "vulcain" is not supported on Windows.'); } - $localhost = gethostbyname('localhost'); - - if (['application/json'] !== $client->request('GET', "http://$localhost:8057/json")->getHeaders()['content-type']) { + if (['application/json'] !== $client->request('GET', 'http://127.0.0.1:8057/json')->getHeaders()['content-type']) { self::markTestSkipped('symfony/http-client-contracts >= 2.0.1 required'); } $process = new Process(['vulcain'], null, [ 'DEBUG' => 1, - 'UPSTREAM' => "http://$localhost:8057", + 'UPSTREAM' => 'http://127.0.0.1:8057', 'ADDR' => ':3000', 'KEY_FILE' => __DIR__.'/Fixtures/tls/server.key', 'CERT_FILE' => __DIR__.'/Fixtures/tls/server.crt', diff --git a/composer.json b/composer.json index b3304ec..880798e 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ "require": { "php": ">=7.2.5", "psr/log": "^1.0", - "symfony/http-client-contracts": "~2.2.1|~2.3.2|^2.4.1", + "symfony/http-client-contracts": "^2.2", "symfony/polyfill-php73": "^1.11", "symfony/polyfill-php80": "^1.15", "symfony/service-contracts": "^1.0|^2"