public function AcquiaSearchWebTestCase::testEnvironment in Acquia Connector 7.3
Same name and namespace in other branches
- 7.2 acquia_search/tests/acquia_search.test \AcquiaSearchWebTestCase::testEnvironment()
Tests Acquia Search environment creation.
Tests executed:
- Acquia Search environment is saved and loaded.
- Acquia Search environment is set as the default environment when created.
- The service class is set to AcquiaSearchService.
- The environment's URL is built as expected.
File
- acquia_search/
tests/ acquia_search.test, line 547 - Tests for the Acquia Search module.
Class
- AcquiaSearchWebTestCase
- Tests the functionality of the Acquia Search module.
Code
public function testEnvironment() {
$this
->enableAcquiaSearchEnvironment();
// Load the newly enabled environment.
$environment = apachesolr_environment_load(ACQUIA_SEARCH_ENVIRONMENT_ID);
// Load the default environment variable.
$default_environment = apachesolr_default_environment();
// Test all the things!
// Check if the environment is a valid variable.
$this
->assertTrue($environment, t('Acquia Search environment saved.'), 'Acquia Search');
// Check if the default environment is Acquia Search.
$this
->assertEqual(ACQUIA_SEARCH_ENVIRONMENT_ID, $default_environment, t('Acquia Search is set to the default environment.'), 'Acquia Search');
// Check if the service class is actually the Acquia Search Service Class.
$class = isset($environment['service_class']) ? $environment['service_class'] : '';
$this
->assertEqual('AcquiaSearchService', $class, t('Acquia Search is using the AcquiaSearchService service class.'), 'Acquia Search');
// Check if the url is the same as the one we wanted to save.
$this
->assertEqual($this->url, $environment['url'], t('Acquia Search is connected to the expected URL.'), 'Acquia Search');
}