protected function AcquiaSearchOverrideTest::setAvailableSearchCores in Acquia Search 2.x
Sets available search cores into the subscription heartbeat data.
Parameters
bool $no_db_flag: Allows to set a limited number of search cores by excluding the one that contains the DB name.
7 calls to AcquiaSearchOverrideTest::setAvailableSearchCores()
- AcquiaSearchOverrideTest::testAcquiaHostingEnvironmentDetected in tests/
src/ Kernel/ AcquiaSearchOverrideTest.php - Tests Acquia Dev hosting environment detected.
- AcquiaSearchOverrideTest::testAcquiaHostingEnvironmentDetectedNoAvailableCores in tests/
src/ Kernel/ AcquiaSearchOverrideTest.php - Tests environment detection without cores available.
- AcquiaSearchOverrideTest::testAcquiaHostingProdEnvironmentDetectedWithoutProdFlag in tests/
src/ Kernel/ AcquiaSearchOverrideTest.php - Tests read-only.
- AcquiaSearchOverrideTest::testAcquiaHostingProdEnvironmentDetectedWithProdFlag in tests/
src/ Kernel/ AcquiaSearchOverrideTest.php - Tests prod environment detection.
- AcquiaSearchOverrideTest::testAcquiaSearchV3CoreDetected in tests/
src/ Kernel/ AcquiaSearchOverrideTest.php - Tests Acquia Dev hosting environment and search v3 core detected.
File
- tests/
src/ Kernel/ AcquiaSearchOverrideTest.php, line 277
Class
- AcquiaSearchOverrideTest
- Tests for Acquia Search override cores.
Namespace
Drupal\Tests\acquia_search\KernelCode
protected function setAvailableSearchCores($no_db_flag = FALSE) {
$acquia_identifier = 'WXYZ-12345';
$solr_hostname = 'mock.acquia-search.com';
$site_folder = $this
->getSiteFolderName();
$ah_db_name = $this
->getDbName();
$core_with_folder_name = [
'balancer' => $solr_hostname,
'core_id' => "{$acquia_identifier}.dev.{$site_folder}",
];
$core_with_db_name = [
'balancer' => $solr_hostname,
'core_id' => "{$acquia_identifier}.dev.{$ah_db_name}",
];
$core_with_acquia_identifier = [
'balancer' => $solr_hostname,
'core_id' => "{$acquia_identifier}",
];
$search_v3_core = [
'balancer' => 'sr-dev.acquia.com',
'core_id' => "{$acquia_identifier}.dev.{$ah_db_name}",
'version' => "v3",
];
if ($no_db_flag) {
$available_cores = [
$core_with_folder_name,
$core_with_acquia_identifier,
];
}
else {
$available_cores = [
$core_with_folder_name,
$core_with_db_name,
$core_with_acquia_identifier,
$search_v3_core,
];
}
$storage = new Storage();
$storage
->setIdentifier($acquia_identifier);
\Drupal::state()
->set('acquia_subscription_data', [
'heartbeat_data' => [
'search_cores' => $available_cores,
],
]);
}