public function AcquiaSearchUnitTestCase::testApacheSolrOverrideAllAcquiaEnvironments in Acquia Connector 7.3
Same name and namespace in other branches
- 7.2 acquia_search/tests/acquia_search.test \AcquiaSearchUnitTestCase::testApacheSolrOverrideAllAcquiaEnvironments()
Tests that existing apachesolr Acquia Search environments get overridden.
File
- acquia_search/
tests/ acquia_search.test, line 317 - Tests for the Acquia Search module.
Class
- AcquiaSearchUnitTestCase
- Unit tests of the functionality of the Acquia Search module.
Code
public function testApacheSolrOverrideAllAcquiaEnvironments() {
global $conf;
unset($conf['apachesolr_environments']);
$acquia_identifier = $this->id;
$site_folder = $this
->randomName(32);
$solr_hostname = $this
->randomName(10) . '.acquia-search.com';
$available_cores = array(
array(
'balancer' => $solr_hostname,
'core_id' => "{$acquia_identifier}.dev.{$site_folder}",
),
array(
'balancer' => $solr_hostname,
'core_id' => "{$acquia_identifier}.dev.testdbname",
),
array(
'balancer' => $solr_hostname,
'core_id' => "{$acquia_identifier}",
),
);
$environments = $this
->getMockedEnvironments();
$ah_env = 'dev';
$ah_db_name = 'testdbname';
$core_service = new PreferredSearchCoreService($acquia_identifier, $ah_env, $site_folder, $ah_db_name, $available_cores);
acquia_search_add_apachesolr_overrides($core_service, $environments);
$expected_url = "http://{$solr_hostname}/solr/{$acquia_identifier}.dev.{$ah_db_name}";
$this
->assertIdentical($conf['apachesolr_environments']['ACQUIA']['url'], $expected_url);
$this
->assertIdentical($conf['apachesolr_environments']['ACQUIA_2']['url'], $expected_url);
$this
->assertTrue(empty($conf['apachesolr_environments']['NON-ACQUIA']['url']));
}