You are here

private function HttpClientTest::initClient in HTTP Client Manager 8

Same name and namespace in other branches
  1. 8.2 tests/src/Unit/HttpClientTest.php \Drupal\Tests\http_client_manager\Unit\HttpClientTest::initClient()

Initialize a new HttpClient instance.

Parameters

string $serviceApi: The service api name.

array $serviceInfo: An array of service info as described into an http_services_api.yml file.

1 call to HttpClientTest::initClient()
HttpClientTest::setUp in tests/src/Unit/HttpClientTest.php

File

tests/src/Unit/HttpClientTest.php, line 198

Class

HttpClientTest
Class HttpClientTest.

Namespace

Drupal\Tests\http_client_manager\Unit

Code

private function initClient($serviceApi, array $serviceInfo) {
  $apiHandler = $this
    ->prophesize(HttpServiceApiHandlerInterface::class);
  $apiHandler
    ->load(Argument::any())
    ->willReturn($serviceInfo);
  $apiHandler = $apiHandler
    ->reveal();
  $event_dispatcher = $this
    ->prophesize(EventDispatcherInterface::class)
    ->reveal();
  $this->client = new HttpClient($serviceApi, $apiHandler, $event_dispatcher);
}