- Issue created by @murz
- Merge request !125Issue #3464623: Manual mocking responses for the http_client service and refactoring → (Merged) created by murz
- 🇦🇲Armenia murz Yerevan, Armenia
Implemented two new functions in the
HttpClientFactoryStub
for mocking responses as stack and dynamically:/** * Adds a custom response to the stack. * * @param \Psr\Http\Message\ResponseInterface $response * A response to add. */ public function stubAddCustomResponseToStack(ResponseInterface $response); /** * Sets a custom handler for the HTTP client. * * @param callable|null $handler * A custom handler or null to unset the handler. */ public function stubSetCustomHandler(?callable $handler);
Together with this, I added the "stub" prefix to all stub functions, to indicate that they are available only in the stub of the service.