Skip to content

Commit 098304b

Browse files
committed
fix: failing http client test
1 parent 4f6224e commit 098304b

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/Instrumentation/Symfony/tests/Integration/HttpClientInstrumentationTest.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ final class HttpClientInstrumentationTest extends AbstractTest
1616
{
1717
public static function setUpBeforeClass(): void
1818
{
19-
TestHttpServer::start();
19+
TestHttpServer::start(8058);
2020
}
2121

2222
protected function getHttpClient(string $_testCase): HttpClientInterface
@@ -32,7 +32,8 @@ public function test_send_request(string $method, string $uri, int $statusCode,
3232
$client = $this->getHttpClient(__FUNCTION__);
3333
$this->assertCount(0, $this->storage);
3434

35-
$response = $client->request($method, $uri, ['bindto' => '127.0.0.1:9876']);
35+
$port = 9876 + (parse_url($uri, PHP_URL_PATH) === '/1' ? 1 : 0);
36+
$response = $client->request($method, $uri, ['bindto' => "127.0.0.1:$port"]);
3637
$response->getStatusCode();
3738
$this->assertCount(1, $this->storage);
3839

@@ -62,7 +63,7 @@ public function test_throw_exception(): void
6263
$this->assertCount(0, $this->storage);
6364

6465
try {
65-
$client->request('GET', 'http://localhost:8057', [
66+
$client->request('GET', 'http://localhost:8058', [
6667
'bindto' => '127.0.0.1:9876',
6768
'auth_ntlm' => [],
6869
]);
@@ -83,10 +84,10 @@ public function test_throw_exception(): void
8384
public function requestProvider(): array
8485
{
8586
return [
86-
['GET', 'http://localhost:8057', Response::HTTP_OK, StatusCode::STATUS_UNSET],
87-
['GET','http://localhost:8057/404', Response::HTTP_NOT_FOUND, StatusCode::STATUS_ERROR],
88-
['POST','http://localhost:8057/json', Response::HTTP_OK, StatusCode::STATUS_UNSET],
89-
['DELETE', 'http://localhost:8057/1', Response::HTTP_OK, StatusCode::STATUS_UNSET],
87+
['GET', 'http://localhost:8058', Response::HTTP_OK, StatusCode::STATUS_UNSET],
88+
['GET','http://localhost:8058/404', Response::HTTP_NOT_FOUND, StatusCode::STATUS_ERROR],
89+
['POST','http://localhost:8058/json', Response::HTTP_OK, StatusCode::STATUS_UNSET],
90+
['DELETE', 'http://localhost:8058/1', Response::HTTP_OK, StatusCode::STATUS_UNSET],
9091
];
9192
}
9293
}

0 commit comments

Comments
 (0)