function DrupalSolrOfflineSearchPagesWebTestCase::testNewAndRemoveSearchPage in Apache Solr Search 6.3
Same name and namespace in other branches
- 8 tests/apachesolr_base.test \DrupalSolrOfflineSearchPagesWebTestCase::testNewAndRemoveSearchPage()
- 7 tests/apachesolr_base.test \DrupalSolrOfflineSearchPagesWebTestCase::testNewAndRemoveSearchPage()
Asserts that we can edit a search environment
File
- tests/
apachesolr_base.test, line 376 - Unit test class that provides tests for base functionality of the Apachesolr Module without having the need of a Solr Server
Class
- DrupalSolrOfflineSearchPagesWebTestCase
- @file Unit test class that provides tests for base functionality of the Apachesolr Module without having the need of a Solr Server
Code
function testNewAndRemoveSearchPage() {
// Create a new search page
$this
->drupalLogin($this->admin_user);
$this
->drupalGet('admin/settings/apachesolr/search-pages');
$this
->assertText(t('Add search page'), t('Create new search page link is available'));
$this
->clickLink(t('Add search page'));
$this
->assertText(t('The human-readable name of the search page configuration.'), t('Search page creation page successfully added'));
$edit = array(
'page_id' => 'solr_testingsuite',
'env_id' => 'solr',
'label' => 'Test Search Page',
'description' => 'Test Description',
'page_title' => 'Test Title',
'search_path' => 'search/searchdifferentpath',
);
$this
->drupalPost($this
->getUrl(), $edit, t('Save'));
$this
->assertResponse(200);
// Make sure the menu is recognized
// Reset static var
apachesolr_search_page_load('core_search', TRUE);
menu_cache_clear_all();
menu_rebuild();
$this
->drupalGet('admin/settings/apachesolr/search-pages');
$this
->assertText(t('Test Search Page'), t('Search Page was successfully created'));
// Remove the same environment
// Note: the first delete link is for the taxonomy search page which is enabled by default.
$this
->clickLink(t('Delete'));
$this
->assertText(t('search page configuration will be deleted.This action cannot be undone.'), t('Delete confirmation page was successfully loaded'));
$this
->drupalPost($this
->getUrl(), array(), t('Delete'));
$this
->assertResponse(200);
// Reset static var
apachesolr_search_page_load('core_search', TRUE);
$this
->drupalGet('admin/settings/apachesolr/search-pages');
$this
->assertNoText(t('Test Search Page'), t('Search Environment was successfully deleted'));
apachesolr_environment_save(array(
'env_id' => 'DummySolr',
'service_class' => 'DummySolr',
'name' => 'dummy server',
'url' => 'http://localhost:8983/solr',
));
$solr = new DummySolr($url = NULL, $env_id = 'DummySolr');
$params = array(
'rows' => 5,
);
$results = apachesolr_search_run('apachesolr_test', $params, '', '', 0, $solr);
$query = apachesolr_current_query('DummySolr');
$this
->assertEqual($query
->getParam('rows'), 5, 'Passed in rows param overrode default');
}