Skip to content

How to test TimeoutException for symfony/http-client #58392

Answered by HypeMC
homersimpsons asked this question in Q&A
Discussion options

You must be logged in to vote

According to the docs:

However, using MockResponse allows simulating chunked responses and timeouts:

$body = function (): \Generator {
    yield 'hello';
    // empty strings are turned into timeouts so that they are easy to test
    yield '';
    yield 'world';
};

$mockResponse = new MockResponse($body());

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by homersimpsons
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants