function DrupalSolrOfflineEnvironmentWebTestCase::testServerOffline in Apache Solr Search 8
Same name and namespace in other branches
- 6.3 tests/apachesolr_base.test \DrupalSolrOfflineEnvironmentWebTestCase::testServerOffline()
- 7 tests/apachesolr_base.test \DrupalSolrOfflineEnvironmentWebTestCase::testServerOffline()
Asserts that the module was installed and that a notice appears that the server is offline
File
- tests/
apachesolr_base.test, line 90 - Unit test class that provides tests for base functionality of the Apachesolr Module without having the need of a Solr Server
Class
- DrupalSolrOfflineEnvironmentWebTestCase
- @file Unit test class that provides tests for base functionality of the Apachesolr Module without having the need of a Solr Server
Code
function testServerOffline() {
// Load the default server.
$env_id = apachesolr_default_environment();
$environment = apachesolr_environment_load($env_id);
$environment['url'] = 'http://localhost/solr/core_that_should_not_exist';
apachesolr_environment_save($environment);
$status = apachesolr_server_status($environment['url']);
$this
->assertFalse($status, t('A false URL could not be loaded and is offline'));
$this
->drupalLogin($this->admin_user);
$this
->drupalGet('admin/config/search/apachesolr');
$text = t('The server seems to be unavailable. Please verify the server settings');
$this
->assertText($text, t('When checking the status of the server it gives the correct message to inform the user that the server is not reachable'));
}