Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4b7ee80

Browse filesBrowse files
Merge branch '4.4' into 5.0
* 4.4: [Mime] Remove unused var [HttpClient] fix monitoring timeouts when other streams are active [PhpUnitBridge] fix syntax on PHP 5.3 [PhpUnitBridge] Fix undefined index when output of "composer show" cannot be parsed properly cascade validation to child forms [PhpUnitBridge] fix undefined var on version 3.4 Move ajax clear event listener initialization on loadToolbar [HttpClient] Throw JsonException instead of TransportException on empty response in Response::toArray() take into account the context when preserving empty array objects [VarExporter] tfix: s/markAsSkipped/markTestSkipped/ bumped Symfony version to 4.4.10 updated VERSION for 4.4.9 updated CHANGELOG for 4.4.9 bumped Symfony version to 3.4.42 updated VERSION for 3.4.41 update CONTRIBUTORS for 3.4.41 updated CHANGELOG for 3.4.41
2 parents 724b90a + db4b39f commit 4b7ee80
Copy full SHA for 4b7ee80

File tree

Expand file treeCollapse file tree

2 files changed

+36
-7
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+36
-7
lines changed

‎Test/HttpClientTestCase.php

Copy file name to clipboardExpand all lines: Test/HttpClientTestCase.php
+24Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,30 @@ public function testUncheckedTimeoutThrows()
786786
}
787787
}
788788

789+
public function testTimeoutWithActiveConcurrentStream()
790+
{
791+
$p1 = TestHttpServer::start(8067);
792+
$p2 = TestHttpServer::start(8077);
793+
794+
$client = $this->getHttpClient(__FUNCTION__);
795+
$streamingResponse = $client->request('GET', 'http://localhost:8067/max-duration');
796+
$blockingResponse = $client->request('GET', 'http://localhost:8077/timeout-body', [
797+
'timeout' => 0.25,
798+
]);
799+
800+
$this->assertSame(200, $streamingResponse->getStatusCode());
801+
$this->assertSame(200, $blockingResponse->getStatusCode());
802+
803+
$this->expectException(TransportExceptionInterface::class);
804+
805+
try {
806+
$blockingResponse->getContent();
807+
} finally {
808+
$p1->stop();
809+
$p2->stop();
810+
}
811+
}
812+
789813
public function testDestruct()
790814
{
791815
$client = $this->getHttpClient(__FUNCTION__);

‎Test/TestHttpServer.php

Copy file name to clipboardExpand all lines: Test/TestHttpServer.php
+12-7Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,28 @@
1919
*/
2020
class TestHttpServer
2121
{
22-
private static $process;
22+
private static $process = [];
2323

24-
public static function start()
24+
public static function start(int $port = 8057)
2525
{
26-
if (self::$process) {
27-
self::$process->stop();
26+
if (isset(self::$process[$port])) {
27+
self::$process[$port]->stop();
28+
} else {
29+
register_shutdown_function(static function () use ($port) {
30+
self::$process[$port]->stop();
31+
});
2832
}
2933

3034
$finder = new PhpExecutableFinder();
31-
$process = new Process(array_merge([$finder->find(false)], $finder->findArguments(), ['-dopcache.enable=0', '-dvariables_order=EGPCS', '-S', '127.0.0.1:8057']));
35+
$process = new Process(array_merge([$finder->find(false)], $finder->findArguments(), ['-dopcache.enable=0', '-dvariables_order=EGPCS', '-S', '127.0.0.1:'.$port]));
3236
$process->setWorkingDirectory(__DIR__.'/Fixtures/web');
3337
$process->start();
38+
self::$process[$port] = $process;
3439

3540
do {
3641
usleep(50000);
37-
} while (!@fopen('http://127.0.0.1:8057/', 'r'));
42+
} while (!@fopen('http://127.0.0.1:'.$port, 'r'));
3843

39-
self::$process = $process;
44+
return $process;
4045
}
4146
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.