Update to Drupal 8.1.1. For more information, see https://www.drupal.org/node/2718713
This commit is contained in:
parent
c0a0d5a94c
commit
9eae24d844
669 changed files with 3873 additions and 1553 deletions
|
@ -82,4 +82,3 @@ function hook_search_plugin_alter(array &$definitions) {
|
|||
/**
|
||||
* @} End of "addtogroup hooks".
|
||||
*/
|
||||
|
||||
|
|
|
@ -208,7 +208,7 @@ function search_update_totals() {
|
|||
// Get total count
|
||||
$total = db_query("SELECT SUM(score) FROM {search_index} WHERE word = :word", array(':word' => $word), array('target' => 'replica'))->fetchField();
|
||||
// Apply Zipf's law to equalize the probability distribution.
|
||||
$total = log10(1 + 1/(max(1, $total)));
|
||||
$total = log10(1 + 1 / (max(1, $total)));
|
||||
db_merge('search_total')
|
||||
->key('word', $word)
|
||||
->fields(array('count' => $total))
|
||||
|
|
|
@ -65,4 +65,3 @@ function template_preprocess_search_result(&$variables) {
|
|||
'#context' => array('info' => $info),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -224,9 +224,9 @@ class SearchQuery extends SelectExtender {
|
|||
protected function parseSearchExpression() {
|
||||
// Matches words optionally prefixed by a - sign. A word in this case is
|
||||
// something between two spaces, optionally quoted.
|
||||
preg_match_all('/ (-?)("[^"]+"|[^" ]+)/i', ' ' . $this->searchExpression , $keywords, PREG_SET_ORDER);
|
||||
preg_match_all('/ (-?)("[^"]+"|[^" ]+)/i', ' ' . $this->searchExpression, $keywords, PREG_SET_ORDER);
|
||||
|
||||
if (count($keywords) == 0) {
|
||||
if (count($keywords) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ class SearchAdvancedSearchFormTest extends SearchTestBase {
|
|||
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
// Create and login user.
|
||||
// Create and log in user.
|
||||
$test_user = $this->drupalCreateUser(array('access content', 'search content', 'use advanced search', 'administer nodes'));
|
||||
$this->drupalLogin($test_user);
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ class SearchBlockTest extends SearchTestBase {
|
|||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
// Create and login user.
|
||||
// Create and log in user.
|
||||
$admin_user = $this->drupalCreateUser(array('administer blocks', 'search content'));
|
||||
$this->drupalLogin($admin_user);
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ class SearchCommentCountToggleTest extends SearchTestBase {
|
|||
// Create searching user.
|
||||
$this->searchingUser = $this->drupalCreateUser(array('search content', 'access content', 'access comments', 'post comments', 'skip comment approval'));
|
||||
|
||||
// Login with sufficient privileges.
|
||||
// Log in with sufficient privileges.
|
||||
$this->drupalLogin($this->searchingUser);
|
||||
|
||||
// Add a comment field.
|
||||
|
|
|
@ -35,7 +35,7 @@ class SearchConfigSettingsFormTest extends SearchTestBase {
|
|||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
// Login as a user that can create and search content.
|
||||
// Log in as a user that can create and search content.
|
||||
$this->searchUser = $this->drupalCreateUser(array('search content', 'administer search', 'administer nodes', 'bypass node access', 'access user profiles', 'administer users', 'administer blocks', 'access site reports'));
|
||||
$this->drupalLogin($this->searchUser);
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ class SearchExactTest extends SearchTestBase {
|
|||
* Tests that the correct number of pager links are found for both keywords and phrases.
|
||||
*/
|
||||
function testExactQuery() {
|
||||
// Login with sufficient privileges.
|
||||
// Log in with sufficient privileges.
|
||||
$user = $this->drupalCreateUser(array('create page content', 'search content'));
|
||||
$this->drupalLogin($user);
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ class SearchKeywordsConditionsTest extends SearchTestBase {
|
|||
|
||||
// Create searching user.
|
||||
$this->searchingUser = $this->drupalCreateUser(array('search content', 'access content', 'access comments', 'skip comment approval'));
|
||||
// Login with sufficient privileges.
|
||||
// Log in with sufficient privileges.
|
||||
$this->drupalLogin($this->searchingUser);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ class SearchLanguageTest extends SearchTestBase {
|
|||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
// Create and login user.
|
||||
// Create and log in user.
|
||||
$test_user = $this->drupalCreateUser(array('access content', 'search content', 'use advanced search', 'administer nodes', 'administer languages', 'access administration pages', 'administer site configuration'));
|
||||
$this->drupalLogin($test_user);
|
||||
|
||||
|
@ -117,10 +117,10 @@ class SearchLanguageTest extends SearchTestBase {
|
|||
// Check for Spanish results.
|
||||
$this->assertLink('Second node this is the Spanish title', 0, 'Second node Spanish title found in search results');
|
||||
$this->assertLink('Third node es', 0, 'Third node Spanish found in search results');
|
||||
// Ensure that results doesn't contain other language nodes.
|
||||
$this->assertNoLink('First node en', 'Search results does not contain first English node');
|
||||
$this->assertNoLink('Second node en', 'Search results does not contain second English node');
|
||||
$this->assertNoLink('Third node en', 'Search results does not contain third English node');
|
||||
// Ensure that results don't contain other language nodes.
|
||||
$this->assertNoLink('First node en', 'Search results do not contain first English node');
|
||||
$this->assertNoLink('Second node en', 'Search results do not contain second English node');
|
||||
$this->assertNoLink('Third node en', 'Search results do not contain third English node');
|
||||
|
||||
// Change the default language and delete English.
|
||||
$path = 'admin/config/regional/language';
|
||||
|
|
|
@ -164,7 +164,7 @@ class SearchPageCacheTagsTest extends SearchTestBase {
|
|||
$this->container->get('plugin.manager.search')->createInstance('node_search')->updateIndex();
|
||||
search_update_totals();
|
||||
|
||||
// Login with searching user again.
|
||||
// Log in with searching user again.
|
||||
$this->drupalLogin($this->searchingUser);
|
||||
|
||||
// Default search cache tags.
|
||||
|
|
|
@ -29,7 +29,7 @@ class SearchPageOverrideTest extends SearchTestBase {
|
|||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
// Login as a user that can create and search content.
|
||||
// Log in as a user that can create and search content.
|
||||
$this->searchUser = $this->drupalCreateUser(array('search content', 'administer search'));
|
||||
$this->drupalLogin($this->searchUser);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ class SearchQueryAlterTest extends SearchTestBase {
|
|||
* Tests that the query alter works.
|
||||
*/
|
||||
function testQueryAlter() {
|
||||
// Login with sufficient privileges.
|
||||
// Log in with sufficient privileges.
|
||||
$this->drupalLogin($this->drupalCreateUser(array('create page content', 'search content')));
|
||||
|
||||
// Create a node and an article with the same keyword. The query alter
|
||||
|
|
|
@ -36,7 +36,7 @@ class SearchRankingTest extends SearchTestBase {
|
|||
// Create a plugin instance.
|
||||
$this->nodeSearch = entity_load('search_page', 'node_search');
|
||||
|
||||
// Login with sufficient privileges.
|
||||
// Log in with sufficient privileges.
|
||||
$this->drupalLogin($this->drupalCreateUser(array('post comments', 'skip comment approval', 'create page content', 'administer search')));
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ class SearchSimplifyTest extends SearchTestBase {
|
|||
$basestrings = explode(chr(10), $input);
|
||||
$strings = array();
|
||||
foreach ($basestrings as $key => $string) {
|
||||
if ($key %2) {
|
||||
if ($key % 2) {
|
||||
// Even line - should simplify down to a space.
|
||||
$simplified = search_simplify($string);
|
||||
$this->assertIdentical($simplified, ' ', "Line $key is excluded from the index");
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\search\Tests;
|
||||
namespace Drupal\Tests\search\Kernel;
|
||||
|
||||
use Drupal\simpletest\KernelTestBase;
|
||||
use Drupal\KernelTests\KernelTestBase;
|
||||
|
||||
/**
|
||||
* Tests the search_excerpt() function.
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\search\Tests;
|
||||
namespace Drupal\Tests\search\Kernel;
|
||||
|
||||
use Drupal\Core\Language\LanguageInterface;
|
||||
use Drupal\simpletest\KernelTestBase;
|
||||
use Drupal\KernelTests\KernelTestBase;
|
||||
|
||||
// The search index can contain different types of content. Typically the type
|
||||
// is 'node'. Here we test with _test_ and _test2_ as the type.
|
Reference in a new issue