~/talk

Your tests are mocking you

Talkat PHP UK Conference 2024 · 2024-02-15..02-16· [testing]
slides:none on file

Argues that mocks deserve repair not exile and demonstrates concrete patterns: handcrafted stubs via anonymous classes, PHPUnit auto-mockers, Prophecy/Mockery, and a Doctrine implementation that bootstraps metadata and creates a schema to run contract tests against the real DB. Shows collaboration tests that replace repo calls with stubs/spies, extracts behavior into simpler collaborators, and converts fragile mocks into fakes verified by a single Doctrine entity manager contract. Uses dozens of GitHub examples to prove tests become readable and maintainable with collaboration tests.

AI-written summary · about

  1. 0:00Introduction
  2. 1:52Test doubles and why use them
  3. 5:28Behavior verification
  4. 11:53Testing app levels
  5. 16:56Design for testability
  6. 19:04Collaboration tests and mocks
  7. 23:21Test doubles: stubs, mocks, spies, fakes
  8. 31:28Mocking indirect output
  9. 36:04Matching contracts with doubles
  10. 43:55Mocking mistakes and anti-patterns
  11. 50:21When to avoid mocking
  12. 52:08Summary
~/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.