One of the risks of writing your own test doubles is that the API of the double can fall out of sync with the API of the real implementation.
In this screencast I walk through an example that explains:
- How interfaces can provide a false sense of security
- Why tests make better contracts than interfaces
- How to run multiple implementations against a shared set of contract tests
If you’ve ever had issues with API drift, try this approach and let me know how it works for you.
Trying to wrap your head around testing? Test-Driven Laravel is a course I recently launched that teaches you how to TDD an app from start to finish. Learn more about it here.