Freezing time, and the code that calls time() directly

A test freezing the framework clock still fails against code calling time() or new DateTime(), because those bypass it entirely.

Carbon::setTestNow('2022-06-14 09:41:02');

now();                    // frozen
Carbon::now();            // frozen
time();                   // NOT frozen
new DateTimeImmutable();  // NOT frozen
DB::raw('NOW()');         // NOT frozen — the database clock

// so a clock interface, injected, is the version that is
// actually testable everywhere.

The database clock is the one that catches people: a column with a CURRENT_TIMESTAMP default is set by MySQL and no amount of test-time freezing affects it. Injecting a clock is the answer that works and it is a large change to retrofit, so the pragmatic position is to freeze what can be frozen and to know which assertions are therefore unreliable.