Commit b020dc29 authored by alexpott's avatar alexpott
Browse files

Issue #2513586 by kfitz, cilefen, jhodgdon, Bojhan, eliza411, ivanstegic,...

Issue #2513586 by kfitz, cilefen, jhodgdon, Bojhan, eliza411, ivanstegic, LewisNyman, lunk_rat, nickrosencrans, stpaultim, webchick: Remove the word "positive" from the "Must include a positive keyword with three characters or more." error message
parent b843b4ae
......@@ -293,7 +293,7 @@ protected function findResults() {
}
if ($status & SearchQuery::NO_POSITIVE_KEYWORDS) {
drupal_set_message($this->formatPlural($this->searchSettings->get('index.minimum_word_size'), 'You must include at least one positive keyword with 1 character or more.', 'You must include at least one positive keyword with @count characters or more.'), 'warning');
drupal_set_message($this->formatPlural($this->searchSettings->get('index.minimum_word_size'), 'You must include at least one keyword to match in the content, and punctuation is ignored.', 'You must include at least one keyword to match in the content. Keywords must be at least @count characters, and punctuation is ignored.'), 'warning');
}
return $find;
......
......@@ -108,7 +108,7 @@ public function validateExposed(&$form, FormStateInterface $form_state) {
if (!$form_state->isValueEmpty($key)) {
$this->queryParseSearchExpression($form_state->getValue($key));
if (count($this->searchQuery->words()) == 0) {
$form_state->setErrorByName($key, $this->formatPlural(\Drupal::config('search.settings')->get('index.minimum_word_size'), 'You must include at least one positive keyword with 1 character or more.', 'You must include at least one positive keyword with @count characters or more.'));
$form_state->setErrorByName($key, $this->formatPlural(\Drupal::config('search.settings')->get('index.minimum_word_size'), 'You must include at least one keyword to match in the content, and punctuation is ignored.', 'You must include at least one keyword to match in the content. Keywords must be at least @count characters, and punctuation is ignored.'));
}
}
}
......
......@@ -93,16 +93,16 @@ public function testSearchFormBlock() {
// Test that after entering a too-short keyword in the form, you can then
// search again with a longer keyword. First test using the block form.
$this->submitGetForm('node', array('keys' => $this->randomMachineName(1)), t('Search'));
$this->assertText('You must include at least one positive keyword', 'Keyword message is displayed when searching for short word');
$this->assertText('You must include at least one keyword to match in the content', 'Keyword message is displayed when searching for short word');
$this->assertNoText(t('Please enter some keywords'), 'With short word entered, no keywords message is not displayed');
$this->submitGetForm(NULL, array('keys' => $this->randomMachineName()), t('Search'), 'search-block-form');
$this->assertNoText('You must include at least one positive keyword', 'Keyword message is not displayed when searching for long word after short word search');
$this->assertNoText('You must include at least one keyword to match in the content', 'Keyword message is not displayed when searching for long word after short word search');
// Same test again, using the search page form for the second search this
// time.
$this->submitGetForm('node', array('keys' => $this->randomMachineName(1)), t('Search'));
$this->drupalPostForm(NULL, array('keys' => $this->randomMachineName()), t('Search'), array(), array(), 'search-form');
$this->assertNoText('You must include at least one positive keyword', 'Keyword message is not displayed when searching for long word after short word search');
$this->assertNoText('You must include at least one keyword to match in the content', 'Keyword message is not displayed when searching for long word after short word search');
}
......
......@@ -57,11 +57,11 @@ function testPhraseSearchPunctuation() {
$edit = array('keys' => '&');
$this->drupalPostForm('search/node', $edit, t('Search'));
$this->assertNoRaw('<strong>&</strong>amp;');
$this->assertText('You must include at least one positive keyword');
$this->assertText('You must include at least one keyword');
$edit = array('keys' => '&amp;');
$this->drupalPostForm('search/node', $edit, t('Search'));
$this->assertNoRaw('<strong>&</strong>amp;');
$this->assertText('You must include at least one positive keyword');
$this->assertText('You must include at least one keyword');
}
}
......@@ -119,10 +119,10 @@ function testSearchText() {
// message, and that if after that you search for a longer keyword, you
// do not still see the message.
$this->drupalPostForm('search/node', array('keys' => $this->randomMachineName(1)), t('Search'));
$this->assertText('You must include at least one positive keyword', 'Keyword message is displayed when searching for short word');
$this->assertText('You must include at least one keyword', 'Keyword message is displayed when searching for short word');
$this->assertNoText(t('Please enter some keywords'), 'With short word entered, no keywords message is not displayed');
$this->drupalPostForm(NULL, array('keys' => $this->randomMachineName()), t('Search'));
$this->assertNoText('You must include at least one positive keyword', 'Keyword message is not displayed when searching for long word after short word search');
$this->assertNoText('You must include at least one keyword', 'Keyword message is not displayed when searching for long word after short word search');
// Test that if you search for a URL with .. in it, you still end up at
// the search page. See issue https://www.drupal.org/node/890058.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment