You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
...
public function __construct(
HttpClient$PDAHttpClient
) {
$this->httpClient = $PDAHttpClient;
}
...
public function executeRequest(RequestInterface$request): string
{
....
$response = $this->httpClient->sendRequest($request);
...
}
ClientTest.php
...$exception = newNetworkException('Could not resolve host', $this->createMock(Request::class));
$this->getContainer()->get('httplug.client.mock')->addException($exception);
$this->getContainer()->get(PDAService::class)->executeRequest(...);
...
Inside the PDAService constructor comes Http\Client\Common\HttpMethodsClient instead of Http\Mock\Client.
And instead of throwing an exception, it tries to find for a vcr fixture.
Other tests that work with vcr are performed correctly.
How can I test a case where an http client should throws a transport error?
The text was updated successfully, but these errors were encountered:
PHP version: 8.0.2
Description
After adding 'httplug.factory.mock', the HttpMethodsClient is returned from the container.
Additional context
services.yaml
test/httplug.yaml
PDAService.php
ClientTest.php
Inside the PDAService constructor comes
Http\Client\Common\HttpMethodsClient
instead ofHttp\Mock\Client
.And instead of throwing an exception, it tries to find for a vcr fixture.
Other tests that work with vcr are performed correctly.
How can I test a case where an http client should throws a transport error?
The text was updated successfully, but these errors were encountered: