Documentation

ClockSensitiveTrait

Helps with mocking the time in your test cases.

This trait provides one self::mockTime() method that freezes the time. It restores the global clock after each test case. self::mockTime() accepts either a string (eg '+1 days' or '2022-12-22'), a DateTimeImmutable, or a boolean (to freeze/restore the global clock).

Tags
author

Nicolas Grekas p@tchwork.com

Table of Contents

Methods

mockTime()  : ClockInterface

Methods


        
On this page

Search results