Skip to content

Commit 0b97bcf

Browse files
fix tests (ter)
1 parent b6d32c8 commit 0b97bcf

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

Tests/CurlHttpClientTest.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,16 @@ protected function getHttpClient(string $testCase): HttpClientInterface
3838
public function testBindToPort()
3939
{
4040
$client = $this->getHttpClient(__FUNCTION__);
41-
$response = $client->request('GET', 'http://localhost:8057', ['bindto' => '127.0.0.1:9876']);
41+
$localhost = gethostbyname('localhost');
42+
$response = $client->request('GET', "http://$localhost:8057", ['bindto' => "$localhost:9876"]);
4243
$response->getStatusCode();
4344

4445
$r = new \ReflectionProperty($response, 'handle');
4546
$r->setAccessible(true);
4647

4748
$curlInfo = curl_getinfo($r->getValue($response));
4849

49-
self::assertSame('127.0.0.1', $curlInfo['local_ip']);
50+
self::assertSame($localhost, $curlInfo['local_ip']);
5051
self::assertSame(9876, $curlInfo['local_port']);
5152
}
5253

@@ -152,13 +153,15 @@ private function getVulcainClient(): CurlHttpClient
152153
return $client;
153154
}
154155

155-
if (['application/json'] !== $client->request('GET', 'http://127.0.0.1:8057/json')->getHeaders()['content-type']) {
156+
$localhost = gethostbyname('localhost');
157+
158+
if (['application/json'] !== $client->request('GET', "http://$localhost:8057/json")->getHeaders()['content-type']) {
156159
$this->markTestSkipped('symfony/http-client-contracts >= 2.0.1 required');
157160
}
158161

159162
$process = new Process(['vulcain'], null, [
160163
'DEBUG' => 1,
161-
'UPSTREAM' => 'http://127.0.0.1:8057',
164+
'UPSTREAM' => "http://$localhost:8057",
162165
'ADDR' => ':3000',
163166
'KEY_FILE' => __DIR__.'/Fixtures/tls/server.key',
164167
'CERT_FILE' => __DIR__.'/Fixtures/tls/server.crt',

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"require": {
2424
"php": ">=7.1.3",
2525
"psr/log": "^1.0",
26-
"symfony/http-client-contracts": "^1.1.10|^2",
26+
"symfony/http-client-contracts": "^1.1.11|~2.1.4|~2.2.1|~2.3.2|^2.4.1",
2727
"symfony/polyfill-php73": "^1.11",
2828
"symfony/service-contracts": "^1.0|^2"
2929
},
@@ -33,7 +33,6 @@
3333
"php-http/httplug": "^1.0|^2.0",
3434
"psr/http-client": "^1.0",
3535
"symfony/dependency-injection": "^4.3|^5.0",
36-
"symfony/http-client-contracts": "^1.1.11|~2.1.4|~2.2.1|~2.3.2|^2.4.1",
3736
"symfony/http-kernel": "^4.4.13",
3837
"symfony/process": "^4.2|^5.0"
3938
},

0 commit comments

Comments
 (0)