Update to Drupal 8.1.2. For more information, see https://www.drupal.org/project/drupal/releases/8.1.2
This commit is contained in:
parent
9eae24d844
commit
28556d630e
1322 changed files with 6699 additions and 2064 deletions
|
@ -67,4 +67,5 @@ class ReindexConfirm extends ConfirmFormBase {
|
|||
$form_state->setRedirectUrl($this->getCancelUrl());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -115,4 +115,5 @@ class SearchBlockForm extends FormBase {
|
|||
public function submitForm(array &$form, FormStateInterface $form_state) {
|
||||
// This form submits to the search page, so processing happens there.
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -101,4 +101,5 @@ class SearchPageForm extends EntityForm {
|
|||
array('query' => $query)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@ abstract class SearchPluginBase extends PluginBase implements ContainerFactoryPl
|
|||
return $this->t('Search');
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildSearchUrlQuery(FormStateInterface $form_state) {
|
||||
|
@ -140,7 +140,7 @@ abstract class SearchPluginBase extends PluginBase implements ContainerFactoryPl
|
|||
return $query;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getHelp() {
|
||||
|
|
|
@ -43,4 +43,5 @@ class Score extends NumericField {
|
|||
return parent::render($values);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,4 +27,5 @@ class SearchPluginManager extends DefaultPluginManager {
|
|||
$this->setCacheBackend($cache_backend, 'search_plugins');
|
||||
$this->alterInfo('search_plugin');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -224,7 +224,7 @@ 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) {
|
||||
return;
|
||||
|
|
|
@ -111,4 +111,5 @@ class SearchCommentCountToggleTest extends SearchTestBase {
|
|||
$this->assertNoText(t('0 comments'), 'Empty comment count does not display for nodes with comment status set to Hidden');
|
||||
$this->assertNoText(t('1 comment'), 'Non-empty comment count does not display for nodes with comment status set to Hidden');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ class SearchCommentTest extends SearchTestBase {
|
|||
$edit_comment['comment_body[0][value]'] = '<h1>' . $comment_body . '</h1>';
|
||||
$full_html_format_id = 'full_html';
|
||||
$edit_comment['comment_body[0][format]'] = $full_html_format_id;
|
||||
$this->drupalPostForm('comment/reply/node/' . $node->id() .'/comment', $edit_comment, t('Save'));
|
||||
$this->drupalPostForm('comment/reply/node/' . $node->id() . '/comment', $edit_comment, t('Save'));
|
||||
|
||||
// Post a comment with an evil script tag in the comment subject and a
|
||||
// script tag nearby a keyword in the comment body. Use the 'FULL HTML' text
|
||||
|
@ -350,4 +350,5 @@ class SearchCommentTest extends SearchTestBase {
|
|||
$this->assertText($node->label(), 'Search for keyword worked');
|
||||
$this->assertNoText(t('Add new comment'));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -71,4 +71,5 @@ class SearchDateIntervalTest extends SearchTestBase {
|
|||
$this->assertLink('Node ES', 0, 'Spanish translation found in search results');
|
||||
$this->assertNoLink('Node EN', 'Search results do not contain English node');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -81,4 +81,5 @@ class SearchEmbedFormTest extends SearchTestBase {
|
|||
$this->assertEqual($this->submitCount, $count, 'Form submission count is correct');
|
||||
$this->submitCount = $count;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -75,4 +75,5 @@ class SearchExactTest extends SearchTestBase {
|
|||
$this->assertNoText(format_date($node->getChangedTime(), 'short'), 'Basic page node does not display post date when post settings are off.');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -58,4 +58,5 @@ class SearchKeywordsConditionsTest extends SearchTestBase {
|
|||
$this->assertText("Dummy search snippet to display.");
|
||||
$this->assertRaw(Html::escape(print_r(array('keys' => 'bike', 'search_conditions' => $keys), TRUE)));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -133,4 +133,5 @@ class SearchLanguageTest extends SearchTestBase {
|
|||
$this->assertNoFieldChecked('edit-site-default-language-en', 'Default language updated.');
|
||||
$this->drupalPostForm('admin/config/regional/language/delete/en', array(), t('Delete'));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -182,7 +182,7 @@ class SearchMultilingualEntityTest extends SearchTestBase {
|
|||
$this->assertEqual(count($search_result), 2, 'The search found 2 results');
|
||||
|
||||
// Test to check for the language of result items.
|
||||
foreach($search_result as $result) {
|
||||
foreach ($search_result as $result) {
|
||||
$this->assertEqual($result['langcode'], 'hu', 'The search found the correct Hungarian result');
|
||||
}
|
||||
|
||||
|
@ -318,4 +318,5 @@ class SearchMultilingualEntityTest extends SearchTestBase {
|
|||
$this->assertEqual($count_foo, count($results), 'Foo count was ' . $count_foo . ' for ' . $message);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -76,4 +76,5 @@ class SearchNodeDiacriticsTest extends SearchTestBase {
|
|||
$this->drupalPostForm('search/node', $edit, t('Search'));
|
||||
$this->assertNoRaw('<strong>æll</strong>');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -59,4 +59,5 @@ class SearchNodePunctuationTest extends SearchTestBase {
|
|||
$this->assertNoRaw('<strong>&</strong>amp;');
|
||||
$this->assertText('You must include at least one keyword');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -95,4 +95,5 @@ class SearchNumberMatchingTest extends SearchTestBase {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -100,4 +100,5 @@ class SearchNumbersTest extends SearchTestBase {
|
|||
$this->assertText($node->label(), format_string('%type: node title shown (search found the node) in search for number %number.', array('%type' => $type, '%number' => $number)));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -40,4 +40,5 @@ class SearchPageOverrideTest extends SearchTestBase {
|
|||
$this->assertText('Dummy search snippet', 'Dummy search snippet is shown');
|
||||
$this->assertText('Test page text is here', 'Page override is working');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -159,4 +159,5 @@ class SearchPageTextTest extends SearchTestBase {
|
|||
$this->assertResponse(200, 'Searching for .something does not lead to a 403 error');
|
||||
$this->assertText('no results', 'Searching for .something gives you a no search results page');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -95,4 +95,5 @@ class SearchPreprocessLangcodeTest extends SearchTestBase {
|
|||
$this->assertText('Search results');
|
||||
$this->assertText('we are testing');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -45,4 +45,5 @@ class SearchQueryAlterTest extends SearchTestBase {
|
|||
$this->assertText('article', 'Article is in search results');
|
||||
$this->assertNoText('page', 'Page is not in search results');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -244,7 +244,8 @@ class SearchRankingTest extends SearchTestBase {
|
|||
// Assert the results.
|
||||
if ($tag == 'notag') {
|
||||
$this->assertEqual($set[$tag_rank]['node']->id(), $nodes[$tag]->id(), 'Search tag ranking for plain text order.');
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$this->assertEqual($set[$tag_rank]['node']->id(), $nodes[$tag]->id(), 'Search tag ranking for "<' . $sorted_tags[$tag_rank] . '>" order.');
|
||||
}
|
||||
}
|
||||
|
@ -273,4 +274,5 @@ class SearchRankingTest extends SearchTestBase {
|
|||
$node->delete();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -47,4 +47,5 @@ class SearchSetLocaleTest extends SearchTestBase {
|
|||
// necessary here.
|
||||
$this->nodeSearchPlugin->execute();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -77,4 +77,5 @@ class SearchSimplifyTest extends SearchTestBase {
|
|||
$this->assertEqual($out, $case[1], $case[2]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -88,4 +88,5 @@ abstract class SearchTestBase extends WebTestBase {
|
|||
$this->fail(format_string('Found the requested form fields at @path', array('@path' => $path)));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -147,4 +147,5 @@ class SearchTokenizerTest extends SearchTestBase {
|
|||
|
||||
return '';
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,12 +5,6 @@ namespace Drupal\Tests\search\Kernel;
|
|||
use Drupal\Core\Language\LanguageInterface;
|
||||
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.
|
||||
const SEARCH_TYPE = '_test_';
|
||||
const SEARCH_TYPE_2 = '_test2_';
|
||||
const SEARCH_TYPE_JPN = '_test3_';
|
||||
|
||||
/**
|
||||
* Indexes content and queries it.
|
||||
*
|
||||
|
@ -18,6 +12,12 @@ const SEARCH_TYPE_JPN = '_test3_';
|
|||
*/
|
||||
class SearchMatchTest extends 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.
|
||||
const SEARCH_TYPE = '_test_';
|
||||
const SEARCH_TYPE_2 = '_test2_';
|
||||
const SEARCH_TYPE_JPN = '_test3_';
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
|
@ -49,10 +49,10 @@ class SearchMatchTest extends KernelTestBase {
|
|||
$this->config('search.settings')->set('index.minimum_word_size', 3)->save();
|
||||
|
||||
for ($i = 1; $i <= 7; ++$i) {
|
||||
search_index(SEARCH_TYPE, $i, LanguageInterface::LANGCODE_NOT_SPECIFIED, $this->getText($i));
|
||||
search_index(static::SEARCH_TYPE, $i, LanguageInterface::LANGCODE_NOT_SPECIFIED, $this->getText($i));
|
||||
}
|
||||
for ($i = 1; $i <= 5; ++$i) {
|
||||
search_index(SEARCH_TYPE_2, $i + 7, LanguageInterface::LANGCODE_NOT_SPECIFIED, $this->getText2($i));
|
||||
search_index(static::SEARCH_TYPE_2, $i + 7, LanguageInterface::LANGCODE_NOT_SPECIFIED, $this->getText2($i));
|
||||
}
|
||||
// No getText builder function for Japanese text; just a simple array.
|
||||
foreach (array(
|
||||
|
@ -60,7 +60,7 @@ class SearchMatchTest extends KernelTestBase {
|
|||
14 => 'ドルーパルが大好きよ!',
|
||||
15 => 'コーヒーとケーキ',
|
||||
) as $i => $jpn) {
|
||||
search_index(SEARCH_TYPE_JPN, $i, LanguageInterface::LANGCODE_NOT_SPECIFIED, $jpn);
|
||||
search_index(static::SEARCH_TYPE_JPN, $i, LanguageInterface::LANGCODE_NOT_SPECIFIED, $jpn);
|
||||
}
|
||||
search_update_totals();
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ class SearchMatchTest extends KernelTestBase {
|
|||
foreach ($queries as $query => $results) {
|
||||
$result = db_select('search_index', 'i')
|
||||
->extend('Drupal\search\SearchQuery')
|
||||
->searchExpression($query, SEARCH_TYPE)
|
||||
->searchExpression($query, static::SEARCH_TYPE)
|
||||
->execute();
|
||||
|
||||
$set = $result ? $result->fetchAll() : array();
|
||||
|
@ -181,7 +181,7 @@ class SearchMatchTest extends KernelTestBase {
|
|||
foreach ($queries as $query => $results) {
|
||||
$result = db_select('search_index', 'i')
|
||||
->extend('Drupal\search\SearchQuery')
|
||||
->searchExpression($query, SEARCH_TYPE_2)
|
||||
->searchExpression($query, static::SEARCH_TYPE_2)
|
||||
->execute();
|
||||
|
||||
$set = $result ? $result->fetchAll() : array();
|
||||
|
@ -204,7 +204,7 @@ class SearchMatchTest extends KernelTestBase {
|
|||
foreach ($queries as $query => $results) {
|
||||
$result = db_select('search_index', 'i')
|
||||
->extend('Drupal\search\SearchQuery')
|
||||
->searchExpression($query, SEARCH_TYPE_JPN)
|
||||
->searchExpression($query, static::SEARCH_TYPE_JPN)
|
||||
->execute();
|
||||
|
||||
$set = $result ? $result->fetchAll() : array();
|
||||
|
@ -251,4 +251,5 @@ class SearchMatchTest extends KernelTestBase {
|
|||
// Check range.
|
||||
$this->assertEqual(!count($scores) || (min($scores) > 0.0 && max($scores) <= 1.0001), TRUE, "Query scoring '$query'");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -281,4 +281,5 @@ class TestSearchPage extends SearchPage {
|
|||
public function label($langcode = NULL) {
|
||||
return $this->label;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Reference in a new issue