Skip to content

Commit b955e5f

Browse files
Merge branch '4.4' into 5.0
* 4.4: [HttpClient] improve testTimeoutIsNotAFatalError Fix for #36715
2 parents 4d9543a + fcc459d commit b955e5f

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
@@ -97,7 +97,7 @@ public function testTimeoutIsNotAFatalError()
9797
{
9898
$client = $this->getHttpClient(__FUNCTION__);
9999
$response = $client->request('GET', 'http://localhost:8057/timeout-body', [
100-
'timeout' => 0.1,
100+
'timeout' => 0.3,
101101
]);
102102

103103
try {
@@ -106,7 +106,16 @@ public function testTimeoutIsNotAFatalError()
106106
} catch (TransportException $e) {
107107
}
108108

109-
usleep(400000);
110-
$this->assertSame('<1><2>', $response->getContent());
109+
for ($i = 0; $i < 10; ++$i) {
110+
try {
111+
$this->assertSame('<1><2>', $response->getContent());
112+
break;
113+
} catch (TransportException $e) {
114+
}
115+
}
116+
117+
if (10 === $i) {
118+
throw $e;
119+
}
111120
}
112121
}

0 commit comments

Comments
 (0)