Add TickingClock: auto-advancing clock for sequential test scenarios #2
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Tests that verify time-ordered behavior (e.g. event sequences, TTL expiry after N operations) must call
FrozenClock::set()manually between each step. This couples test logic to specific timestamps and makes the intent less clear.Proposed API
Each
now()call advances the internal time by the configured interval before returning. The first call returns the initial time without advancing.Benefits
set()bookkeepingClockInterface— drop-in replacement forFrozenClockwhere appropriateAcceptance criteria
TickingClock(DateTimeImmutable $start, DateInterval $tick): voidnow()returns$start, each subsequent call adds$tickClockInterface