~/talk

Mocks Aren't Stubs, Fakes, Dummies or Spies

Talkat SymfonyLive London 2014 · 2014-09-25..09-26· [testing]
links:none on file
slides:none on file

Describes clear, actionable distinctions: dummy fake stub mock spy with when to use each, and why mocks verify indirect outputs while spies only observe them; shows tools and examples using PHPUnit, Prophecy, Mockery, php-vcr and an in‑memory SQLite fake DB; reports a home‑grown fake Recurly web service that runs tests reliably for two years; warns that over‑specification (one example has 16 mocks and 18 expectations) makes tests brittle and recommends mocking only owned interfaces.

AI-written summary · about

  1. 0:00Introduction to test doubles
  2. 1:34Terminology and tools
  3. 5:56Working with dummies
  4. 9:25Using fakes in testing
  5. 14:31Implementing stubs
  6. 16:28Understanding mocks
  7. 18:38Spies and observability
  8. 21:07State vs behavior testing
  9. 24:17Best practices and pitfalls
  10. 29:03Examples and future design
  11. 37:12Q&A and closing
~/search
type to search 8,222 conferences, 162,397 speakers and 219,688 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
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
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.