update core to 7.36
This commit is contained in:
@@ -149,6 +149,17 @@ class SearchQuery extends SelectQueryExtender {
|
||||
$this->searchExpression = $expression;
|
||||
$this->type = $module;
|
||||
|
||||
// Add a search_* tag. This needs to be added before any preExecute methods
|
||||
// for decorated queries are called, as $this->prepared will be set to TRUE
|
||||
// and tags added in the execute method will never get used. For example,
|
||||
// if $query is extended by 'SearchQuery' then 'PagerDefault', the
|
||||
// search-specific tag will be added too late (when preExecute() has
|
||||
// already been called from the PagerDefault extender), and as a
|
||||
// consequence will not be available to hook_query_alter() implementations,
|
||||
// nor will the correct hook_query_TAG_alter() implementations get invoked.
|
||||
// See node_search_execute().
|
||||
$this->addTag('search_' . $module);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -494,9 +505,8 @@ class SearchQuery extends SelectQueryExtender {
|
||||
$this->orderBy('calculated_score', 'DESC');
|
||||
}
|
||||
|
||||
// Add tag and useful metadata.
|
||||
// Add useful metadata.
|
||||
$this
|
||||
->addTag('search_' . $this->type)
|
||||
->addMetaData('normalize', $this->normalize)
|
||||
->fields('i', array('type', 'sid'));
|
||||
|
||||
|
@@ -8,8 +8,8 @@ files[] = search.test
|
||||
configure = admin/config/search/settings
|
||||
stylesheets[all][] = search.css
|
||||
|
||||
; Information added by Drupal.org packaging script on 2014-05-08
|
||||
version = "7.28"
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
project = "drupal"
|
||||
datestamp = "1399522731"
|
||||
datestamp = "1427943826"
|
||||
|
||||
|
@@ -2048,6 +2048,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.
|
||||
*/
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2014-05-08
|
||||
version = "7.28"
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
project = "drupal"
|
||||
datestamp = "1399522731"
|
||||
datestamp = "1427943826"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2014-05-08
|
||||
version = "7.28"
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
project = "drupal"
|
||||
datestamp = "1399522731"
|
||||
datestamp = "1427943826"
|
||||
|
||||
|
12
modules/search/tests/search_node_tags.info
Normal file
12
modules/search/tests/search_node_tags.info
Normal file
@@ -0,0 +1,12 @@
|
||||
name = "Test search node tags"
|
||||
description = "Support module for Node search tags testing."
|
||||
package = Testing
|
||||
version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
|
23
modules/search/tests/search_node_tags.module
Normal file
23
modules/search/tests/search_node_tags.module
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Dummy module implementing a node search hooks for search module testing.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Implements hook_query_alter().
|
||||
*/
|
||||
function search_node_tags_query_alter(QueryAlterableInterface $query) {
|
||||
if ($query->hasTag('search_node')) {
|
||||
variable_set('search_node_tags_test_query_tag', TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_query_TAG_alter().
|
||||
*/
|
||||
function search_node_tags_query_search_node_alter(QueryAlterableInterface $query) {
|
||||
variable_set('search_node_tags_test_query_tag_hook', TRUE);
|
||||
}
|
Reference in New Issue
Block a user