Skip to content

Commit 0f3c7d8

Browse files
Merge branch '5.3' into 5.4
* 5.3: [HttpClient] Fix closing curl-multi handle too early on destruct [PropertyInfo] fix precedence of __get() vs properties [Form] Improve Persian (Farsi) Translation For Forms [Uid] Add ulid keyword in composer.json fix: lowest version of psr container supported [HttpClient] Don't reset timeout counter when initializing requests
2 parents c72a380 + bc772e5 commit 0f3c7d8

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

HttpClient/Test/HttpClientTestCase.php

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

838+
public function testTimeoutOnInitialize()
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+
foreach ($responses as $response) {
854+
try {
855+
$response->getContent();
856+
$this->fail(TransportExceptionInterface::class.' expected');
857+
} catch (TransportExceptionInterface $e) {
858+
}
859+
}
860+
$responses = [];
861+
862+
$duration = microtime(true) - $start;
863+
864+
$this->assertLessThan(1.0, $duration);
865+
} finally {
866+
$p1->stop();
867+
$p2->stop();
868+
}
869+
}
870+
838871
public function testTimeoutOnDestruct()
839872
{
840873
$p1 = TestHttpServer::start(8067);

0 commit comments

Comments
 (0)