Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-54613

Missing iteminstance in unit test

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Trivial
    • Resolution: Fixed
    • 3.0.4
    • 3.0.5
    • Unit tests

    Description

      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.

      Attachments

        Activity

          People

            maherne Michael Aherne
            maherne Michael Aherne
            Rajesh Taneja Rajesh Taneja
            David Monllaó David Monllaó
            CiBoT CiBoT
            Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Stevani Andolo
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              11/Jul/16