Skip to content

Commit 4e74ebf

Browse files
Merge branch '5.0'
* 5.0: [HttpClient] improve testTimeoutIsNotAFatalError Fix for #36715
2 parents 42e5978 + b955e5f commit 4e74ebf

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

Tests/HttpClientTestCase.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public function testTimeoutIsNotAFatalError()
109109
{
110110
$client = $this->getHttpClient(__FUNCTION__);
111111
$response = $client->request('GET', 'http://localhost:8057/timeout-body', [
112-
'timeout' => 0.1,
112+
'timeout' => 0.3,
113113
]);
114114

115115
try {
@@ -118,8 +118,17 @@ public function testTimeoutIsNotAFatalError()
118118
} catch (TransportException $e) {
119119
}
120120

121-
usleep(400000);
122-
$this->assertSame('<1><2>', $response->getContent());
121+
for ($i = 0; $i < 10; ++$i) {
122+
try {
123+
$this->assertSame('<1><2>', $response->getContent());
124+
break;
125+
} catch (TransportException $e) {
126+
}
127+
}
128+
129+
if (10 === $i) {
130+
throw $e;
131+
}
123132
}
124133

125134
public function testResponseStreamRewind()

0 commit comments

Comments
 (0)