mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-06 03:50:04 +02:00
Update dependencies.
This commit is contained in:
parent
43c00721ca
commit
feb9ac315b
11243 changed files with 338413 additions and 11922 deletions
|
@ -88,8 +88,8 @@ interface HttpClientInterface
|
|||
/**
|
||||
* Yields responses chunk by chunk as they complete.
|
||||
*
|
||||
* @param ResponseInterface|ResponseInterface[]|iterable $responses One or more responses created by the current HTTP client
|
||||
* @param float|null $timeout The idle timeout before yielding timeout chunks
|
||||
* @param ResponseInterface|iterable<array-key, ResponseInterface> $responses One or more responses created by the current HTTP client
|
||||
* @param float|null $timeout The idle timeout before yielding timeout chunks
|
||||
*/
|
||||
public function stream($responses, float $timeout = null): ResponseStreamInterface;
|
||||
}
|
||||
|
|
|
@ -15,6 +15,8 @@ namespace Symfony\Contracts\HttpClient;
|
|||
* Yields response chunks, returned by HttpClientInterface::stream().
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*
|
||||
* @extends \Iterator<ResponseInterface, ChunkInterface>
|
||||
*/
|
||||
interface ResponseStreamInterface extends \Iterator
|
||||
{
|
||||
|
|
|
@ -835,6 +835,38 @@ abstract class HttpClientTestCase extends TestCase
|
|||
}
|
||||
}
|
||||
|
||||
public function testTimeoutOnDestruct()
|
||||
{
|
||||
$p1 = TestHttpServer::start(8067);
|
||||
$p2 = TestHttpServer::start(8077);
|
||||
|
||||
$client = $this->getHttpClient(__FUNCTION__);
|
||||
$start = microtime(true);
|
||||
$responses = [];
|
||||
|
||||
$responses[] = $client->request('GET', 'http://localhost:8067/timeout-header', ['timeout' => 0.25]);
|
||||
$responses[] = $client->request('GET', 'http://localhost:8077/timeout-header', ['timeout' => 0.25]);
|
||||
$responses[] = $client->request('GET', 'http://localhost:8067/timeout-header', ['timeout' => 0.25]);
|
||||
$responses[] = $client->request('GET', 'http://localhost:8077/timeout-header', ['timeout' => 0.25]);
|
||||
|
||||
try {
|
||||
while ($response = array_shift($responses)) {
|
||||
try {
|
||||
unset($response);
|
||||
$this->fail(TransportExceptionInterface::class.' expected');
|
||||
} catch (TransportExceptionInterface $e) {
|
||||
}
|
||||
}
|
||||
|
||||
$duration = microtime(true) - $start;
|
||||
|
||||
$this->assertLessThan(1.0, $duration);
|
||||
} finally {
|
||||
$p1->stop();
|
||||
$p2->stop();
|
||||
}
|
||||
}
|
||||
|
||||
public function testDestruct()
|
||||
{
|
||||
$client = $this->getHttpClient(__FUNCTION__);
|
||||
|
|
|
@ -18,6 +18,9 @@ class TestHttpServer
|
|||
{
|
||||
private static $process = [];
|
||||
|
||||
/**
|
||||
* @return Process
|
||||
*/
|
||||
public static function start(int $port = 8057)
|
||||
{
|
||||
if (isset(self::$process[$port])) {
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
"minimum-stability": "dev",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "2.4-dev"
|
||||
"dev-main": "2.5-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/contracts",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue