-
Bug
-
Resolution: Fixed
-
Trivial
-
3.0.4
-
MOODLE_30_STABLE
-
MOODLE_30_STABLE
-
The test in sub_test_update_final_grade() in lib/grade/tests/grade_item_test.php creates a grade_item with itemtype and itemmodule set (to "mod" and "quiz" respectively), but no iteminstance.
As far as I can see, if these are set then iteminstance should also be set. Obviously this test passes as-is, but if there are any third-party modules which handle \core\event\user_graded they will be getting an event object state that they wouldn't be expected to handle in actual running of the system.
The attached patch just adds the iteminstance of the existing quiz to the new grade_item.