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

Static variable in grade_get_letters causes unit test failures

    XMLWordPrintable

    Details

      Description

      If unit tests for whatever reason need to validate against a different set of grade letters, then it will fail especially if it is run after the core_grades_testsuite because the static $cache variable does not reset and the contextid collides with previous unit tests.

       

      Steps to reproduce:

      1. Have unit tests that implement a different set of grade letters
      2. Run vendor/bin/phpunit --testsuite=core_grades_testsuite,your_custom_testsuite

       

      Expected:

      Unit tests pass

       

      Actual:

      Unit tests fail with unexpected grade letters getting returned (because it is using the default grade letters)

        Attachments

          Activity

            People

            Assignee:
            marcusboon Marcus Boon
            Reporter:
            marcusboon Marcus Boon
            Peer reviewer:
            Dmitrii Metelkin
            Integrator:
            Andrew Nicols
            Tester:
            CiBoT
            Participants:
            Component watchers:
            Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              13/Jul/20

                Time Tracking

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours, 6 minutes
                2h 6m