mirror of
https://github.com/moodle/moodle.git
synced 2025-03-21 16:10:15 +01:00
Merge branch 'MDL-76731_401' of https://github.com/PhilippImhof/moodle into MOODLE_401_STABLE
This commit is contained in:
commit
181cab2fbd
@ -2248,4 +2248,43 @@ EOF;
|
||||
// Set the list new list of editors.
|
||||
set_config('texteditors', implode(',', $list));
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow to check for minimal Moodle version.
|
||||
*
|
||||
* @Given the site is running Moodle version :minversion or higher
|
||||
* @param string $minversion The minimum version of Moodle required (inclusive).
|
||||
*/
|
||||
public function the_site_is_running_moodle_version_or_higher(string $minversion): void {
|
||||
global $CFG;
|
||||
require_once($CFG->libdir . '/environmentlib.php');
|
||||
|
||||
$currentversion = normalize_version(get_config('', 'release'));
|
||||
|
||||
if (version_compare($currentversion, $minversion, '<')) {
|
||||
throw new Moodle\BehatExtension\Exception\SkippedException(
|
||||
'Site must be running Moodle version ' . $minversion . ' or higher'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow to check for maximum Moodle version.
|
||||
*
|
||||
* @Given the site is running Moodle version :maxversion or lower
|
||||
* @param string $maxversion The maximum version of Moodle required (inclusive).
|
||||
*/
|
||||
public function the_site_is_running_moodle_version_or_lower(string $maxversion): void {
|
||||
global $CFG;
|
||||
require_once($CFG->libdir . '/environmentlib.php');
|
||||
|
||||
$currentversion = normalize_version(get_config('', 'release'));
|
||||
|
||||
if (version_compare($currentversion, $maxversion, '>')) {
|
||||
throw new Moodle\BehatExtension\Exception\SkippedException(
|
||||
'Site must be running Moodle version ' . $maxversion . ' or lower'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
27
lib/tests/behat/min_max_version.feature
Normal file
27
lib/tests/behat/min_max_version.feature
Normal file
@ -0,0 +1,27 @@
|
||||
@core
|
||||
Feature: Check for minimum or maximimum version of Moodle
|
||||
In order adapt acceptance tests for different versions of Moodle
|
||||
As a developer
|
||||
I should be able to skip tests according to the Moodle version present on a site
|
||||
|
||||
Scenario: Minimum version too low
|
||||
Given the site is running Moodle version 99.0 or higher
|
||||
# The following steps should not be executed. If they are, the test will fail.
|
||||
When I log in as "admin"
|
||||
Then I should not see "Home"
|
||||
|
||||
Scenario: Maximum version too high
|
||||
Given the site is running Moodle version 3.0 or lower
|
||||
# The following steps should not be executed. If they are, the test will fail.
|
||||
When I log in as "admin"
|
||||
Then I should not see "Home"
|
||||
|
||||
Scenario: Minimum version OK
|
||||
Given the site is running Moodle version 3.0 or higher
|
||||
When I log in as "admin"
|
||||
Then I should see "Home"
|
||||
|
||||
Scenario: Maximum version OK
|
||||
Given the site is running Moodle version 99.0 or lower
|
||||
When I log in as "admin"
|
||||
Then I should see "Home"
|
Loading…
x
Reference in New Issue
Block a user