? 01-304924.patch ? 261258-node-save-required-fields-3.patch ? 261258-node-save-required-fields-test.patch ? 302440-2.patch ? 308262-simpletest-js-cleanup.patch ? advanced-search-test.patch ? advanced-search-test_0.patch ? advanced-search-test_0.patch.1 ? awesome_ui_10.patch ? contact.test-cleanup_0.patch ? hook_taxonomy_term_load.patch ? make-plain-title-242873-60.patch ? make-plain-title-242873-60.patch.1 ? old_update_1.patch ? taxonomy_list_plus_admin_and_edit_term_tests_1.patch ? taxonomy_list_plus_admin_and_edit_term_tests_2.patch ? taxonomy_list_plus_admin_and_edit_term_tests_3.patch ? taxonomy_list_plus_test.patch ? taxonomy_refactor.patch ? taxonomy_refactor_2.patch ? taxonomy_term_cleanup.patch ? taxonomy_term_load.patch ? taxonomy_vocab_and_term_edit_local_tasks_usability.patch ? taxonomy_vocab_and_term_edit_local_tasks_usability_0.patch ? term.patch ? term_edit.patch ? term_tab_menu_cleanup.patch ? term_tab_menu_cleanup.patch.1 ? term_tab_menu_cleanup.patch.2 ? unappaproved.patch ? modules/taxonomy/taxonomy_refactor.patch ? modules/taxonomy/taxonomyrelation ? modules/taxonomy/taxonomyrelation.tar.gz.txt ? modules/taxonomy/taxonomysynonym ? modules/taxonomy/taxonomysynonym.tar.gz.txt ? sites/default/files ? sites/default/settings.php Index: modules/search/search.test =================================================================== RCS file: /cvs/drupal/drupal/modules/search/search.test,v retrieving revision 1.7 diff -u -p -r1.7 search.test --- modules/search/search.test 6 Sep 2008 08:36:20 -0000 1.7 +++ modules/search/search.test 16 Sep 2008 21:43:00 -0000 @@ -196,6 +196,75 @@ class SearchBikeShed extends DrupalWebTe } } +class SearchAdvancedSearchForm extends DrupalWebTestCase { + protected $node; + + /** + * Implementation of getInfo(). + */ + function getInfo() { + return array( + 'name' => t('Advanced search form'), + 'description' => t('Indexes content and tests the advanced search form.'), + 'group' => t('Search'), + ); + } + + /** + * Implementation of setUp(). + */ + function setUp() { + parent::setUp('search'); + // Create and login user. + $test_user = $this->drupalCreateUser(array('access content', 'search content', 'use advanced search', 'administer nodes')); + $this->drupalLogin($test_user); + + // Create initial node. + $node = $this->drupalCreateNode(); + $this->node = $this->drupalCreateNode(); + + // First update the index. This does the initial processing + node_update_index(); + + // Then, run the shutdown function. Testing is a unique case where indexing + // and searching has to happen in the same request, so running the shutdown + // function manually is needed to finish the indexing process. + search_update_totals(); + } + + /** + * Test using the search form with GET and POST queries. + * Test using the advanced search form to limit search to pages. + */ + function testNodeType() { + $this->assertTrue($this->node->type == 'page', t('Node type is page.')); + + // Assert that the dummy title doesn't equal the real title + $dummy_title = 'Lorem ipsum'; + $this->assertNotEqual($dummy_title, $this->node->title, t("Dummy title doens't equal node title")); + + // Search for the dummy title with a GET query + $this->drupalGet('search/node/' . drupal_urlencode($dummy_title)); + $this->assertNoText($this->node->title, t('Page node is not found with dummy title.')); + + // Search for the title of the node with a GET query + $this->drupalGet('search/node/' . drupal_urlencode($this->node->title)); + $this->assertText($this->node->title, t('Page node is found with GET query.')); + + // Search for the title of the node with a POST query + $edit = array('or' => $this->node->title); + $this->drupalPost('search/node', $edit, t('Advanced search')); + $this->assertText($this->node->title, t('Page node is found with POST query.')); + + // Advanced search type option + $this->drupalPost('search/node', array_merge($edit, array('type[page]' => 'page')), t('Advanced search')); + $this->assertText($this->node->title, t('Page node is found with POST query and type:page.')); + + $this->drupalPost('search/node', array_merge($edit, array('type[article]' => 'article')), t('Advanced search')); + $this->assertText('bike shed', t('Article node is not found with POST query and type:article.')); + } +} + class SearchRankingTestCase extends DrupalWebTestCase { /** * Implementation of getInfo().