You are here

public function SearchApiSolrTest::testBasicAuth in Search API Solr 8

Same name and namespace in other branches
  1. 8.2 tests/src/Kernel/SearchApiSolrTest.php \Drupal\Tests\search_api_solr\Kernel\SearchApiSolrTest::testBasicAuth()

Test that basic auth config gets passed to Solarium.

File

tests/src/Kernel/SearchApiSolrTest.php, line 612

Class

SearchApiSolrTest
Tests index and search capabilities using the Solr search backend.

Namespace

Drupal\Tests\search_api_solr\Kernel

Code

public function testBasicAuth() {
  $server = $this
    ->getServer();
  $config = $server
    ->getBackendConfig();
  $config['connector_config']['username'] = 'foo';
  $config['connector_config']['password'] = 'bar';
  $server
    ->setBackendConfig($config);

  /** @var \Drupal\search_api_solr\SolrBackendInterface $backend */
  $backend = $server
    ->getBackend();
  $auth = $backend
    ->getSolrConnector()
    ->getEndpoint()
    ->getAuthentication();
  $this
    ->assertEquals([
    'username' => 'foo',
    'password' => 'bar',
  ], $auth);
}