You are here

protected function SearchApiSolrTest::checkBasicAuth in Search API Solr 8.3

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

Test that basic auth config gets passed to Solarium.

1 call to SearchApiSolrTest::checkBasicAuth()
SearchApiSolrTest::checkBackendSpecificFeatures in tests/src/Kernel/SearchApiSolrTest.php
Checks backend specific features.

File

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

Class

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

Namespace

Drupal\Tests\search_api_solr\Kernel

Code

protected function checkBasicAuth() {
  $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);
  $config['connector_config']['username'] = '';
  $config['connector_config']['password'] = '';
  $server
    ->setBackendConfig($config);
}