Description
Symfony version(s) affected: 5.2.0
Description
Whenever I want to use the new framework.http_client.mock_response_factory
option introduced in #35893, I get the following error:
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service ".debug.http_client.inner".
How to reproduce
Configure
framework:
test: true
session:
storage_id: session.storage.mock_file
http_client:
mock_response_factory: 'some_factory_id'
and let the container build.
Possible Solution
I think that's because the debug clients are only registered in the HttpClientPass
which is excecuted after the extension.
Not really sure how this is supposed to work.
Moreover, I don't even see how that feature is supposed to work anyway:
symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
Lines 2073 to 2077 in 42f440e
How does setClass()
help here? The http client services are created using the HttpClient::create()
factory so without resetting the factory, this here cannot work?
Pinging @GaryPEGEOT as the original author of that feature, maybe I missed something completely :)