You are here

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

Tests prod environment detection.

Acquia Prod environment and a DB name and AH_PRODUCTION is set - so it should override to connect to the prod index.

File

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

Class

AcquiaSearchOverrideTest
Tests for Acquia Search override cores.

Namespace

Drupal\Tests\acquia_search\Kernel

Code

public function testAcquiaHostingProdEnvironmentDetectedWithProdFlag() {
  $_ENV['AH_SITE_ENVIRONMENT'] = 'prod';
  $_ENV['AH_SITE_NAME'] = 'testsite1prod';
  $_ENV['AH_SITE_GROUP'] = 'testsite1';
  $_SERVER['AH_PRODUCTION'] = TRUE;
  $this
    ->setAvailableSearchCores();
  $connector_plugin = new SearchApiSolrAcquiaConnector([], 'foo', [
    'foo',
  ]);
  $solr_connector = $connector_plugin
    ->create($this->container, [], 'foo', [
    'foo',
  ]);
  $config = $solr_connector
    ->defaultConfiguration();
  $this
    ->assertEquals(ACQUIA_SEARCH_OVERRIDE_AUTO_SET, $config['overridden_by_acquia_search']);
  $this
    ->assertEquals('WXYZ-12345', $config['index_id']);
  $this
    ->assertGetUpdateQueryNoException($solr_connector);
}