~/talk

Watch the clock

Talkat Dutch PHP Conference 2024 · 2024-03-12..03-15· [php]
slides:none on file

Argues that exporting time behind a Clock interface (PSR/FIG) and using DateTimeImmutable fixes flaky time tests by replacing calls to time() with injection of a SystemClock and, in tests, a FrozenClock (often via an anonymous class). Shows building a current-datetime factory, swapping it for a clock interface, and using Symfony and other existing implementations so tests become deterministic, interop increases, and multiple conflicting clock libs disappear from projects.

AI-written summary · about

  1. 0:00Clock interfaces
  2. 1:32Clock interfaces in PHP
  3. 2:35Testing time-dependent code
  4. 5:07Injecting time for testability
  5. 9:26Moving time dependency up
  6. 10:09Datetime factory
  7. 11:56Abstracting with clock interface
  8. 14:27Frozen clock for tests
  9. 15:31What is the PHP-FIG and why it matters
  10. 18:00Birth of the clock PSR
  11. 20:52Challenges in PSR finalization
  12. 24:05Time zones and immutable objects
  13. 26:15Using clock interface in practice
  14. 28:25Benefits of clock implementations
  15. 29:34Q&A on clock testing
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.