function GoogleApplianceSearchBlockAvailability::testCase_BlockFormSubmitRedirect in Google Search Appliance 7
File
- testing/
google_appliance.test, line 416 - Implements automated simpletest routines for integration testing of the Google Appliance module.
Class
- GoogleApplianceSearchBlockAvailability
- Search Block availability: test the interaction for appearance of the block search form via blocks administration, then be sure submission of that form redirect to the results page.
Code
function testCase_BlockFormSubmitRedirect() {
// hide the core search form from the front page
$edit = array(
'pages' => 'search',
);
$this
->drupalPost('admin/structure/block/manage/search/form/configure', $edit, t('Save block'));
// put our search form on the frontpage in 'content' so soemthing is on the frontpage
$edit = array();
$edit['blocks[google_appliance_ga_block_search_form][region]'] = 'content';
$this
->drupalPost('admin/structure/block', $edit, t('Save blocks'));
// go to the front page and submit the search form
$terms = array(
'search_keys' => 'test search',
);
$this
->drupalPost('node', $terms, t('Search'));
// confirm that the user is redirected to the results apge
$this
->assertEqual($this
->getUrl(), url('gsearch/' . $terms['search_keys'], array(
'absolute' => TRUE,
)), t('<b>{MTP:2.3.2.7}</b> Block Search Form sumbission redirected to correct url (successful interaction: block search form works as expected).'));
}