You are here

public function AcquiaSearchOverrideTest::testApacheSolrOverrideWhenCoreWithDbNameNotAvailable in Acquia Search 2.x

Test core override when a core with db name is unavailable.

Tests that it selects the correct preferred search core ID for the override URL when limited number of core ID is available.

File

tests/src/Kernel/AcquiaSearchOverrideTest.php, line 205

Class

AcquiaSearchOverrideTest
Tests for Acquia Search override cores.

Namespace

Drupal\Tests\acquia_search\Kernel

Code

public function testApacheSolrOverrideWhenCoreWithDbNameNotAvailable() {

  // When the core ID with the DB name in it is not available, it should
  // override the URL value with the core ID that has the site folder name
  // in it.
  $_ENV['AH_SITE_ENVIRONMENT'] = 'dev';
  $_ENV['AH_SITE_NAME'] = 'testsite1dev';
  $_ENV['AH_SITE_GROUP'] = 'testsite1';
  $this
    ->setAvailableSearchCores(TRUE);
  $connector_plugin = new SearchApiSolrAcquiaConnector([], 'foo', [
    'foo',
  ]);
  $solr_connector = $connector_plugin
    ->create($this->container, [], 'foo', [
    'foo',
  ]);
  $config = $solr_connector
    ->defaultConfiguration();
  $site_folder = $this
    ->getSiteFolderName();
  $this
    ->assertEquals(ACQUIA_SEARCH_OVERRIDE_AUTO_SET, $config['overridden_by_acquia_search']);
  $this
    ->assertEquals('WXYZ-12345.dev.' . $site_folder, $config['index_id']);
  $this
    ->assertGetUpdateQueryNoException($solr_connector);
}