Index: search.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/search/search.test,v
retrieving revision 1.10
diff -u -p -r1.10 search.test
--- search.test	10 Nov 2008 05:19:50 -0000	1.10
+++ search.test	22 Nov 2008 00:57:09 -0000
@@ -347,3 +347,51 @@ class SearchRankingTestCase extends Drup
     }
   }
 }
+
+class SearchBlockTestCase extends DrupalWebTestCase {
+  function getInfo() {
+    return array(
+      'name' => t('Search block'),
+      'description' => t('Test the search block form.'),
+      'group' => t('Search'),
+    );
+  }
+
+  function setUp() {
+    parent::setUp('search');
+
+    // Create and login user
+    $admin_user = $this->drupalCreateUser(array('administer blocks', 'search content'));
+    $this->drupalLogin($admin_user);
+  }
+
+  /**
+   * Test that the search block form works correctly.
+   */
+  function testBlock() {
+    // Disable the theme form to avoid confusion.
+    $settings = theme_get_settings();
+    $settings['toggle_search'] = FALSE;
+    variable_set('theme_settings', $settings);
+
+    // 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');
+  }
+}
