function DrupalSolrOfflineEnvironmentWebTestCase::testCreateNewSearchEnvironment in Apache Solr Search 6.3
Same name and namespace in other branches
- 8 tests/apachesolr_base.test \DrupalSolrOfflineEnvironmentWebTestCase::testCreateNewSearchEnvironment()
- 7 tests/apachesolr_base.test \DrupalSolrOfflineEnvironmentWebTestCase::testCreateNewSearchEnvironment()
Asserts that we can edit a search environment
File
- tests/
apachesolr_base.test, line 213 - 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 testCreateNewSearchEnvironment() {
// Create a new environment
$this
->drupalLogin($this->admin_user);
$this
->drupalGet('admin/settings/apachesolr/settings');
$this
->assertText(t('Add search environment'), t('Create new environment link is available'));
$this
->clickLink(t('Add search environment'));
$this
->assertText(t('Make this Solr search environment the default'), t('Environment creation page successfully added'));
$edit = array(
'url' => 'http://localhost:8983/solr',
'name' => 'my test description',
'env_id' => 'solr_test',
);
$this
->drupalPost($this
->getUrl(), $edit, t('Save'));
$this
->assertResponse(200);
$this
->drupalGet('admin/settings/apachesolr/settings');
$this
->assertText(t('my test description'), t('Search Environment was successfully created'));
// Make this new search environment the default
$this
->drupalGet('admin/settings/apachesolr/settings');
// Click on the second environment edit link
$this
->clickLink(t('Edit'), 1);
$this
->assertText(t('Example: http://localhost:8983/solr'), t('Edit page was successfully loaded'));
$edit = array(
'make_default' => 1,
'conf[apachesolr_read_only]' => APACHESOLR_READ_ONLY,
);
$this
->drupalPost($this
->getUrl(), $edit, t('Save'));
$this
->assertResponse(200);
cache_clear_all();
$this
->drupalGet('admin/settings/apachesolr/settings');
$this
->assertText(t('my test description (Default)'), t('New Search environment was successfully changed to default environment'));
// Clear our cache.
apachesolr_environments_clear_cache();
$mode = apachesolr_environment_variable_get('solr_test', 'apachesolr_read_only', APACHESOLR_READ_WRITE);
$this
->assertEqual($mode, APACHESOLR_READ_ONLY, 'Environment successfully changed to read only');
// Verify the modus
$this
->drupalGet('admin/settings/apachesolr/settings');
// Click on the second environment edit link
$this
->clickLink(t('Edit'), 0);
$this
->assertFieldChecked('edit-conf-apachesolr-read-only-1', t('Environment successfully changed to read only'));
}