Skip to content

2026

Do your unit tests depend on the system clock?

Testing code that uses new DateTime('now') or time() is painful. You end up mocking native functions, or accepting fragile tests that fail at midnight.

Direct dependency on a concrete implementation causes the same kind of problems for the logger, the cache, or the ID generator...