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

This commit is contained in:
Marina Glancy 2022-10-27 09:14:44 +02:00 committed by Jun Pataleta
parent 720bd60fc6
commit 635e852564
3 changed files with 16 additions and 2 deletions

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.
@ -146,4 +147,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.');
}
}
}

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:

View File

@ -93,7 +93,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 |