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

Unit test failure from test_usergetdate

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 1.9.9
    • 1.9.8
    • Libraries
    • None
    • MOODLE_19_STABLE
    • MOODLE_19_STABLE

      I get a unit test failure in 1.9.x stable.

      Fail: lib/simpletest/testmoodlelib.php / ? moodlelib_test / ? test_usergetdate / ?
      Equal expectation fails because [Integer: 3] differs from [Integer: 11] by 8 at [/Users/tim/Documents/workspace/moodle_19/lib/simpletest/testmoodlelib.php line 289]

      The issue is that when you call usergetdate($ts) without the second argument, the result depends on $USER. What you should do is

      1. At the start of this test, store $USER->timezone in a temporary variable.

      2. Also at the start of the test, set $USER->timezone to a particular value.

      3. At the end of the test, set $USER->timezone back to the real value that you stored in a temporary.

            andyjdavis Andrew Davis
            timhunt Tim Hunt
            Nobody Nobody (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.