DEV Community

Discussion on: How to Make Your Laravel App More Testable

Collapse
 
ashallendesign profile image
Ash Allen

Hi Marcin, thanks for the comment.

I do agree that this test can be seen as being fragile, but this example is just a simple one that we can use to explain the concept of dependency injection and mocking. In a real-life scenario, I'd have used an interface instead to decouple the code so that we could switch out the implementation further down the line. I didn't want to throw too much at the readers at once though and scare them away haha :)