Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
3.1.3
-
MOODLE_31_STABLE
-
MOODLE_31_STABLE, MOODLE_32_STABLE
-
MDL-57137_question_category_with_parent_category -
Description
In behat tests (perhaps, and in phpunit tests too) there is no way to create question category with specified parent, like SubCategory category in the following example:
And the following "question categories" exist:
|
| contextlevel | reference | name | parent |
|
| Course | C1 | Category | 0 |
|
| Course | C1 | SubCategory | Category |
|
It is because there is bug in lib/tests/behat/behat_data_generators
https://github.com/moodle/moodle/blob/0fbe41f4cda13cb2a205aaa4eaeeec45e595e3b6/lib/tests/behat/behat_data_generators.php#L163
The following code
'question categories' => array( |
'datagenerator' => 'question_category', |
'required' => array('name', 'contextlevel', 'reference'), |
'switchids' => array('questioncategory' => 'category') |
),
|
should be
'question categories' => array( |
'datagenerator' => 'question_category', |
'required' => array('name', 'contextlevel', 'reference'), |
'switchids' => array('questioncategory' => 'parent') |
),
|
The field "category" doesn't exist in question_category table, that is why it should be replaced with "parent".
Thread on general developer forum: https://moodle.org/mod/forum/discuss.php?d=343438.