function DrupalSolrOfflineEnvironmentWebTestCase::testCloneSearchEnvironment in Apache Solr Search 6.3
Same name and namespace in other branches
- 8 tests/apachesolr_base.test \DrupalSolrOfflineEnvironmentWebTestCase::testCloneSearchEnvironment()
- 7 tests/apachesolr_base.test \DrupalSolrOfflineEnvironmentWebTestCase::testCloneSearchEnvironment()
Asserts that we can clone a search environment
File
- tests/
apachesolr_base.test, line 185 - 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 testCloneSearchEnvironment() {
$this
->drupalLogin($this->admin_user);
$this
->drupalGet('admin/settings/apachesolr/settings');
$this
->assertText(t('Clone'), t('Clone button is available'));
$this
->drupalGet('admin/settings/apachesolr/settings/solr/clone');
$this
->assertText(t('Are you sure you want to clone search environment localhost server'), t('Clone confirmation page was successfully loaded'));
$this
->drupalPost($this
->getUrl(), array(), t('Clone'));
$this
->assertResponse(200);
// Reset vars
apachesolr_load_all_environments(TRUE);
$this
->drupalGet('admin/settings/apachesolr/settings');
$this
->assertText(t('localhost server [cloned]'), t('Search Environment was successfully cloned'));
// Check if the bundles and configurations are exactly the same
// after we clear the caches.
apachesolr_environments_clear_cache();
$envs = apachesolr_load_all_environments();
$this
->assertEqual(count($envs), 2, 'Now we have 2 environments');
$orig_env = $envs['solr'];
unset($envs['solr']);
$cloned_env = array_pop($envs);
$this
->assertTrue($this
->_nestedCompare($orig_env['index_bundles'], $cloned_env['index_bundles']));
$this
->assertTrue($this
->_nestedCompare($orig_env['conf'], $cloned_env['conf']));
}