-
Bug
-
Resolution: Fixed
-
Minor
-
3.7.2
-
MOODLE_37_STABLE
-
MOODLE_36_STABLE, MOODLE_37_STABLE
-
MDL-66836-master -
Behat resets config variables between scenarios, but only if they are the predefined ones that were set up during the Moodle installation for behat init (i.e. they are listed in a settings.php file).
If you have config variables that are set up ad-hoc, for example to be used in indicating some behaviour for Behat mocking, or something that (for real use outside Behat) can be set up only in config.php, then these are not reset.
Example (this requires a new step definition, I'll include a patch):
Scenario: Set a silly admin setting and a real one
|
Given the following config values are set as admin:
|
| config | value |
|
| sillyvariable | 666 |
|
| enableoutcomes | 1 |
|
|
Scenario: Check both admin settings
|
Then config value "enableoutcomes" should be "0" # passes
|
And config value "sillyvariable" should be "" # fails, value is actually 666
|
If you run the second scenario on its own, the test passes. If you run both scenarios, the test fails at the indicated line.