TestClock class
Injectable clock for persistence assertions (bug #833, remediation 2).
TTL expiry is asserted virtually: advanceTime moves the clock forward without the wall clock moving, so a 24-hour TTL costs microseconds, not 24 hours — no real sleeps in the suite. The clock is an instance the owning test controls; advancing it never affects anything else.
The class is callable (DateTime Function()), so it plugs directly into
every API that accepts a clock source, e.g. TtlCachePolicy(clock: ...).
Properties
Methods
-
advanceTime(
Duration duration) → void -
Move the clock forward by
duration— virtually, never by sleeping. -
call(
) → DateTime -
The clock as a plain
DateTimesource. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited