You are here

public function ClientManagerTest::testGetClientForCluster in Elasticsearch Connector 8.5

Same name and namespace in other branches
  1. 8.7 tests/src/Unit/ElasticSearch/ClientManagerTest.php \Drupal\Tests\elasticsearch_connector\Unit\ElasticSearch\ClientManagerTest::testGetClientForCluster()
  2. 8.6 tests/src/Unit/ElasticSearch/ClientManagerTest.php \Drupal\Tests\elasticsearch_connector\Unit\ElasticSearch\ClientManagerTest::testGetClientForCluster()

@covers ::getClientForCluster

File

tests/src/Unit/ElasticSearch/ClientManagerTest.php, line 51

Class

ClientManagerTest
@coversDefaultClass \Drupal\elasticsearch_connector\ElasticSearch\ClientManager

Namespace

Drupal\Tests\elasticsearch_connector\Unit\ElasticSearch

Code

public function testGetClientForCluster() {
  $cluster = $this
    ->prophesize(Cluster::class);
  $cluster
    ->getRawUrl()
    ->willReturn('http://example.com');
  $cluster = $cluster
    ->reveal();
  $cluster->options['use_authentication'] = TRUE;
  $cluster->options['username'] = 'Tom';
  $cluster->options['password'] = 'Waits';
  $cluster->options['authentication_type'] = 'basic_auth';
  $client = $this->clientManager
    ->getClientForCluster($cluster);
  $this
    ->assertInstanceOf(ClientInterface::class, $client);
}