public function GoogleCSETestCase::testDisabledSearchModuleConfig in Google Custom Search Engine 7.3
Tests all SiteSearch configuration options.
File
- tests/
google_cse.test, line 43 - Google CSE module tests.
Class
- GoogleCSETestCase
- @file Google CSE module tests.
Code
public function testDisabledSearchModuleConfig() {
// Need to have user for this test.
$this
->setupGoogleCSEUser();
// Need to have Google CSE as default search.
$this
->setupGoogleCSEAsDefaultSearch();
// Need to setup page with Google CSE search block until redirect issue is fixed.
// @todo Figure out why going to /search/google ended up in a redirect loop.
$this
->setupGoogleCSESearchPage();
// Post to config form to save settings.
$edit = array();
$edit['google_cse_results_tab'] = "Google CSE";
$edit['google_cse_results_prefix'] = 'Prefix Text';
$this
->drupalPost('admin/config/search/settings', $edit, t('Save configuration'));
// Go to Google CSE search page.
$this
->drupalGet('node/1');
// Assert that all SiteSearch options are there.
$this
->assertText('Google CSE', "Tab label changed.");
$this
->assertText('Prefix Text', "Prefix text added.");
// Disable Search module.
module_disable(array(
'search',
));
// Flush caches for menu rebuild.
drupal_flush_all_caches();
menu_rebuild();
// See if admin form is accessible.
$this
->drupalGet('admin/config/search/cse-settings');
$this
->assertNoText('You are not authorized to access this page.');
// Post different config options for more checks.
$edit = array();
$edit['google_cse_results_prefix'] = 'Changed Some Stuff';
$edit['google_cse_results_suffix'] = 'Suffix Text';
$this
->drupalPost('admin/config/search/cse-settings', $edit, t('Save configuration'));
// Go to Google CSE search page.
$this
->drupalGet('node/1');
// Assert select options have changed.
// Need to use raw option since the select list options are not visible.
$this
->assertText('Changed Some Stuff', "Prefix text changed.");
$this
->assertText('Suffix Text', "Suffix text added.");
}