~/talk

Design how your objects talk to each other through mocking

Talkat Forum PHP 2014 · 2014-10-23..10-24· [testing]
slides:none on file

Argues that tests should assert inter-object messages not just end state, demonstrating five test doubles (dummy, stub, spy, mock, fake) with the Prophecy library and showing concrete refactor patterns: replace flags with a payment method interface, add adapters to keep drivers interchangeable, split messenger interfaces, and introduce a JobRepository interface to avoid mocking Doctrine. Shows a controller test with roughly ten collaborators and seven messages, then refactors to far fewer collaborators and clearer responsibilities.

AI-written summary · about

  1. 0:00Introduction to mocking and design
  2. 3:22What is test-driven development
  3. 11:26Types of test doubles explained
  4. 19:10Design principles and mocking
  5. 20:14Example 1: Simplifying MVC controllers
  6. 25:13Example 2: Basket checkout refactor
  7. 29:08Example 3: Browser emulation issues
  8. 34:44Example 4: ATM screen interface segregation
  9. 36:30Example 5: Entity repository dependency inversion
  10. 40:26Best practices for mocking
  11. 42:51Recap and key takeaways
  12. 43:19Q&A on PHPUnit mocks
~/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.