Skip to content

Commit

Permalink
fix tests (quinter)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed Jun 7, 2021
1 parent 0b97bcf commit d6c0260
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
11 changes: 4 additions & 7 deletions Tests/CurlHttpClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,15 @@ 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');
$r->setAccessible(true);

$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']);
}

Expand Down Expand Up @@ -153,15 +152,13 @@ private function getVulcainClient(): CurlHttpClient
return $client;
}

$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']) {
$this->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',
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"require": {
"php": ">=7.1.3",
"psr/log": "^1.0",
"symfony/http-client-contracts": "^1.1.11|~2.1.4|~2.2.1|~2.3.2|^2.4.1",
"symfony/http-client-contracts": "^1.1.10|^2",
"symfony/polyfill-php73": "^1.11",
"symfony/service-contracts": "^1.0|^2"
},
Expand Down

0 comments on commit d6c0260

Please sign in to comment.