public function AcquiaSearchUnitTestCase::testApacheSolrOverrideWhenCoreWithDbNameNotAvailable in Acquia Connector 7.3
Same name and namespace in other branches
- 7.2 acquia_search/tests/acquia_search.test \AcquiaSearchUnitTestCase::testApacheSolrOverrideWhenCoreWithDbNameNotAvailable()
Test override.
Tests that it selects the correct preferred search core ID for the override URL when limited number of core ID is available.
File
- acquia_search/
tests/ acquia_search.test, line 284 - Tests for the Acquia Search module.
Class
- AcquiaSearchUnitTestCase
- Unit tests of the functionality of the Acquia Search module.
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.
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}",
),
);
$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.{$site_folder}";
$this
->assertIdentical($conf['apachesolr_environments']['ACQUIA']['url'], $expected_url);
}