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

Add function to moodlelib.php to get the current time to allow it to be changed for unit tests.

    XMLWordPrintable

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 2.4.1, 3.4.4, 3.5.1
    • STABLE backlog
    • Libraries

    Description

      Add current_time() to moodlelib - which either just returns time() or if a global is set returns the time relative to a manually set time.

      Add a function to the data generator to allow the current time to be set.

      Replace all calls to time() with current_time().

      Concerns

      • current_time() is not very descriptive
      • changing all calls to time() will create a large patch (1232 instances outside of tests)

      Attachments

        Issue Links

          Activity

            People

              moodle.com moodle.com
              damyon Damyon Wiese
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Laurent David, Raquel Ortega, Sara Arjona (@sarjona)
              Votes:
              4 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated: