diff options
author | David Rothstein <drothstein@gmail.com> | 2015-03-30 23:28:55 -0400 |
---|---|---|
committer | David Rothstein <drothstein@gmail.com> | 2015-03-30 23:28:55 -0400 |
commit | 668db719eb6938d828cc6f066bedfacf620182d6 (patch) | |
tree | c3b42b868a1ef84fe03ee037825fbfb3fa82fd97 /modules/search/search.test | |
parent | fc31045bbeb1c7f6332c133315f038bf14f028d3 (diff) | |
download | brdo-668db719eb6938d828cc6f066bedfacf620182d6.tar.gz brdo-668db719eb6938d828cc6f066bedfacf620182d6.tar.bz2 |
Issue #2364069 by damiankloip: Search specific tags are not available and hook_query_TAG_alter hooks are not invoked
Diffstat (limited to 'modules/search/search.test')
-rw-r--r-- | modules/search/search.test | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/modules/search/search.test b/modules/search/search.test index 19f4e5510..5f16db3f8 100644 --- a/modules/search/search.test +++ b/modules/search/search.test @@ -2049,6 +2049,47 @@ class SearchNodeAccessTest extends DrupalWebTestCase { } /** + * Tests node search with query tags. + */ +class SearchNodeTagTest extends DrupalWebTestCase { + public $test_user; + + public static function getInfo() { + return array( + 'name' => 'Node search query tags', + 'description' => 'Tests Node search tags functionality.', + 'group' => 'Search', + ); + } + + function setUp() { + parent::setUp('search', 'search_node_tags'); + node_access_rebuild(); + + // Create a test user and log in. + $this->test_user = $this->drupalCreateUser(array('search content')); + $this->drupalLogin($this->test_user); + } + + /** + * Tests that the correct tags are available and hooks invoked. + */ + 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.'); + } +} + +/** * Tests searching with locale values set. */ class SearchSetLocaleTest extends DrupalWebTestCase { |