-
Bug
-
Resolution: Fixed
-
Minor
-
3.5.6, 3.6.6, 3.7.2, 3.8
-
MOODLE_35_STABLE, MOODLE_36_STABLE, MOODLE_37_STABLE, MOODLE_38_STABLE
-
MOODLE_35_STABLE, MOODLE_36_STABLE, MOODLE_37_STABLE
-
The behat step: (e.g. from question/tests/behat/question_categories.feature)
And the following "question categories" exist:
|
| contextlevel | reference | questioncategory | name |
|
| Course | C1 | Top | top |
|
| Course | C1 | top | Default for C1 |
|
| Course | C1 | Default for C1 | Subcategory |
|
| Course | C1 | top | Used category |
|
is not very intelligent. When it looks up 'questioncategory' (the parent category) then it just searches by name. Unforunately, every context in Moodle gets a category called 'top'.
Amazingly, this does not normally cause problems, because the top categories are only created on-demand, and if your test only involves the question bank in one context, it works.
Except ... if you have qtype_coderunner installed. If you do, then as part of its install, it causes the 'top' cateogry in the system context to appear, and then all sorts of Behat tests start failing.
So, when looking up the parent questioncategory, it should pay attention to the values in the contextlevel & reference columns, and only consider categories in the same context.