I have a class into which I inject an instance of Symfony\Component\HttpClient\HttpClient
as a constructor parameter.
I'm looking at the documentation page at https://symfony.com/doc/current/components/http_client.html#testing-http-clients-and-responses where it is suggested to use $client = new MockHttpClient($responses);
as a way to create a Mock client.
When I pass the mocked client to my class I get the error:
TypeError: Argument 3 passed to
App\Allocator\Strategy\AbstractStrategy::__construct()
must be an instance ofSymfony\Component\HttpClient\HttpClient
, instance ofSymfony\Component\HttpClient\MockHttpClient
received.
How do I obtain a Mock that will satisfy the typing constraint and also allow me to mock up responses?
Aucun commentaire:
Enregistrer un commentaire