function SearchAdvancedSearchForm::setUp

Overrides DrupalWebTestCase::setUp

File

modules/search/search.test, line 327

Class

SearchAdvancedSearchForm
Indexes content and tests the advanced search form.

Code

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();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.