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

Missing iteminstance in unit test

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: 3.0.4
    • Fix Version/s: 3.0.5
    • Component/s: Unit tests
    • Labels:

      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

            Assignee:
            maherne Michael Aherne
            Reporter:
            maherne Michael Aherne
            Peer reviewer:
            Rajesh Taneja
            Integrator:
            David Monllaó
            Tester:
            CiBoT
            Participants:
            Component watchers:
            Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              11/Jul/16