Skip to content

Commit 0af3239

Browse files
Merge branch '5.3' into 5.4
* 5.3: Match 5.1 mailer configuration [Cache] Make sure PdoAdapter::prune() always returns a bool [HttpKernel] Fix broken mock [HttpClient] Fix handling timeouts when responses are destructed [PropertyInfo] Support for intersection types
2 parents 13280fe + 53b0f5b commit 0af3239

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

HttpClient/Test/HttpClientTestCase.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -835,6 +835,38 @@ public function testTimeoutWithActiveConcurrentStream()
835835
}
836836
}
837837

838+
public function testTimeoutOnDestruct()
839+
{
840+
$p1 = TestHttpServer::start(8067);
841+
$p2 = TestHttpServer::start(8077);
842+
843+
$client = $this->getHttpClient(__FUNCTION__);
844+
$start = microtime(true);
845+
$responses = [];
846+
847+
$responses[] = $client->request('GET', 'http://localhost:8067/timeout-header', ['timeout' => 0.25]);
848+
$responses[] = $client->request('GET', 'http://localhost:8077/timeout-header', ['timeout' => 0.25]);
849+
$responses[] = $client->request('GET', 'http://localhost:8067/timeout-header', ['timeout' => 0.25]);
850+
$responses[] = $client->request('GET', 'http://localhost:8077/timeout-header', ['timeout' => 0.25]);
851+
852+
try {
853+
while ($response = array_shift($responses)) {
854+
try {
855+
unset($response);
856+
$this->fail(TransportExceptionInterface::class.' expected');
857+
} catch (TransportExceptionInterface $e) {
858+
}
859+
}
860+
861+
$duration = microtime(true) - $start;
862+
863+
$this->assertLessThan(1.0, $duration);
864+
} finally {
865+
$p1->stop();
866+
$p2->stop();
867+
}
868+
}
869+
838870
public function testDestruct()
839871
{
840872
$client = $this->getHttpClient(__FUNCTION__);

0 commit comments

Comments
 (0)