summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-03-08 05:16:20 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-03-08 05:16:20 +0000
commitce81be0c8c50b6939ee45d3860a0d190381068b2 (patch)
tree61cf3d1a724b916815af50815c8845c89af4b097 /modules
parentd7fa0f82d052ee74ad1d8fa8ab5183078d4ec96b (diff)
downloadbrdo-ce81be0c8c50b6939ee45d3860a0d190381068b2.tar.gz
brdo-ce81be0c8c50b6939ee45d3860a0d190381068b2.tar.bz2
#292565 by John Morahan and lyricnz: Fix 404 on search form from a 404 page (with tests).
Diffstat (limited to 'modules')
-rw-r--r--modules/search/search.test32
1 files changed, 31 insertions, 1 deletions
diff --git a/modules/search/search.test b/modules/search/search.test
index 2415abe65..96e036801 100644
--- a/modules/search/search.test
+++ b/modules/search/search.test
@@ -383,8 +383,13 @@ class SearchBlockTestCase extends DrupalWebTestCase {
parent::setUp('search');
// Create and login user
- $admin_user = $this->drupalCreateUser(array('administer blocks'));
+ $admin_user = $this->drupalCreateUser(array('administer blocks', 'search content'));
$this->drupalLogin($admin_user);
+
+ // Disable the theme form to avoid confusion.
+ $settings = theme_get_settings();
+ $settings['toggle_search'] = FALSE;
+ variable_set('theme_settings', $settings);
}
function testSearchFormBlock() {
@@ -398,4 +403,29 @@ class SearchBlockTestCase extends DrupalWebTestCase {
$this->drupalPost('admin/build/block', $edit, t('Save blocks'));
$this->assertText(t('The block settings have been updated.'), t('Block successfully move to footer region.'));
}
+
+ /**
+ * Test that the search block form works correctly.
+ */
+ function testBlock() {
+ // Enable the block, and place it in the 'content' region so that it isn't
+ // hidden on 404 pages.
+ $edit = array('search_form[region]' => 'content');
+ $this->drupalPost('admin/build/block', $edit, t('Save blocks'));
+
+ // Test a normal search via the block form, from the front page.
+ $terms = array('search_block_form' => 'test');
+ $this->drupalPost('node', $terms, t('Search'));
+ $this->assertText('Your search yielded no results');
+
+ // Test a search from the block on a 404 page.
+ $this->drupalPost('foo', $terms, t('Search'));
+ $this->assertText('Your search yielded no results');
+
+ // Test a search from the block when it doesn't appear on the search page.
+ $edit = array('pages' => 'search');
+ $this->drupalPost('admin/build/block/configure/search/form', $edit, t('Save block'));
+ $this->drupalPost('node', $terms, t('Search'));
+ $this->assertText('Your search yielded no results');
+ }
}