function SearchNodeTagTest::testNodeSearchQueryTags

Tests that the correct tags are available and hooks invoked.

File

modules/search/search.test, line 2124

Class

SearchNodeTagTest
Tests node search with query tags.

Code

function testNodeSearchQueryTags() {
  $this->drupalCreateNode(array(
    'body' => array(
      LANGUAGE_NONE => array(
        array(
          'value' => 'testing testing testing.',
        ),
      ),
    ),
  ));
  // Update the search index.
  module_invoke_all('update_index');
  search_update_totals();
  $edit = array(
    'keys' => 'testing',
  );
  $this->drupalPost('search/node', $edit, t('Search'));
  $this->assertTrue(variable_get('search_node_tags_test_query_tag', FALSE), 'hook_query_alter() was invoked and the query contained the "search_node" tag.');
  $this->assertTrue(variable_get('search_node_tags_test_query_tag_hook', FALSE), 'hook_query_search_node_alter() was invoked.');
}

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