Merge branch 'MDL-74419-master' of https://github.com/sarjona/moodle

This commit is contained in:
Víctor Déniz 2022-04-07 20:20:54 +01:00
commit 384f6712bb
2 changed files with 21 additions and 2 deletions

View File

@ -346,12 +346,16 @@ class engine extends \core_search\engine {
$DB->sql_like('description1', '?', false, false) . ' OR ' .
$DB->sql_like('description2', '?', false, false) .
')';
$params = array(
// Remove quotes from the query.
$q = str_replace('"', '', $q);
$params = [
'%' . $q . '%',
'%' . $q . '%',
'%' . $q . '%',
'%' . $q . '%'
);
];
return array($sql, $params);
}

View File

@ -44,6 +44,21 @@ Feature: Use global search interface
And I follow "ForumName1"
And I should see "ForumName1" in the ".breadcrumb" "css_element"
@javascript
Scenario: Search from search page with quotes
Given I search for "zombies" using the header global search box
And I should see "No results"
When I set the field "id_q" to "\"amphibians\""
# You cannot press "Search" because there's a fieldset with the same name that gets in the way.
And I press "id_submitbutton"
Then I should see "ForumName1"
And I should see "ForumDesc1"
And I should see "PageName1"
And I should see "PageDesc1"
# Check the link works.
And I follow "ForumName1"
And I should see "ForumName1" in the ".breadcrumb" "css_element"
@javascript
Scenario: Search starting from site context (no within option)
When I search for "frogs" using the header global search box