mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
298c13ac3b
This commit adds the PSR-20 ClockInterface to core, with a moodle-specific extension to the Interface at `\core\clock`, and a standard clock at `\core\system_clock`. Further clocks are provided as `\incrementing_clock` and `\frozen_clock` which are available to unit tests using: - `$this->mock_clock_with_incrementing(?int $starttime = null);` - `$this->mock_clock_with_frozen(?int $time = null);` For the incrementing clock, every call to fetch the time will bump the current time by one second. For the frozen clock the time will not change, but can be modified with: - `$clock->set_to(int $time);`; and - `$clock->bump(int $seconds = 1);`