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

PHP unit test lib/tests/scheduled_task_test.php fails with daylight savings

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 3.9.6
    • Fix Version/s: None
    • Component/s: Unit tests
    • Labels:
      None
    • Affected Branches:
      MOODLE_39_STABLE

      Description

      Running vendor/bin/phpunit /lib/tests/scheduled_task_test.php will fail if run during change over from UK daylight savings (UTC) to UK BST (UTC + 1).

      Pre-requisites: System time is set to Sun Mar 28 01:00:07 UTC 2021

      Test failure output:

      # date
      Sun Mar 28 01:00:07 UTC 2021
      # vendor/bin/phpunit lib/tests/scheduled_task_test.php
      Moodle 3.9.3+ (Build: 20201127), 1d37c818cc56956be55a6399a26c42c37513c11b
      Php: 7.4.14, pgsql: 11.9 (Debian 11.9-1.pgdg90+1), OS: Linux 4.19.121-linuxkit x86_64
      PHPUnit 7.5.20 by Sebastian Bergmann and contributors.
       
      .F..........                                                      12 / 12 (100%)
       
      Time: 7.63 seconds, Memory: 60.50 MB
       
      There was 1 failure:
       
      1) core_scheduled_task_testcase::test_get_next_scheduled_time
      Next scheduled time is 1am.
      Failed asserting that 1616976000 matches expected 1616979600.
       
      /var/www/html/moodle/lib/tests/scheduled_task_test.php:76
      /var/www/html/moodle/lib/phpunit/classes/advanced_testcase.php:80
      

      NOTE: This is a really obscure issue that is only going to cause tests to break for about 1 hour out of the year.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              stronk7 Eloy Lafuente (stronk7)
              Reporter:
              brudinie guy thomas
              Participants:
              Component watchers:
              Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: