MDL-76103 search: skip solr behat tests if solr is not installed

This commit is contained in:
Marina Glancy
2022-11-04 11:22:27 +08:00
committed by Jun Pataleta
parent 4e1d36c8bc
commit ff013438d6
3 changed files with 16 additions and 2 deletions
+12
View File
@@ -27,6 +27,7 @@
require_once(__DIR__ . '/../../../lib/behat/behat_base.php');
use Behat\Gherkin\Node\TableNode as TableNode;
use Moodle\BehatExtension\Exception\SkippedException;
/**
* Behat search-related step definitions.
@@ -145,4 +146,15 @@ class behat_search extends behat_base {
public function i_update_the_global_search_index() {
\core_search\manager::instance()->index(false);
}
/**
* This step looks to see if Solr is installed or skip the rest of the scenario otherwise
*
* @Given /^solr is installed/
*/
public function solr_is_installed() {
if (!function_exists('solr_get_version')) {
throw new SkippedException('Skipping this scenario because Solr is not installed.');
}
}
}
+2 -1
View File
@@ -5,7 +5,8 @@ Feature: Select users when searching for user-created content
I need to be able to add users to the select list in the search form
Background:
Given the following config values are set as admin:
Given solr is installed
And the following config values are set as admin:
| enableglobalsearch | 1 |
| searchengine | solr |
And the following "courses" exist:
+2 -1
View File
@@ -78,7 +78,8 @@ Feature: Use global search interface
@javascript
Scenario: Check that groups option in search form appears when intended
# Switch to mocked Solr search because simpledb doesn't support groups.
Given the following config values are set as admin:
Given solr is installed
And the following config values are set as admin:
| searchengine | solr |
And the following "groups" exist:
| name | course | idnumber |