Back to the Learning!

Laracasts is packed full with over 1,000 lessons just like this one.

Sign up to get full access or log in to your account and sit back.

Published On Aug. 18th 2017

Testing Laravel: Homemade Fakes

Episode 15 Run Time 18:28

Download

In this lesson, we'll review how to take a hardcoded Redis reference in our controllers, and extract its logic to a first class citizen. Beyond improved readability, an immediate benefit to this refactor is that it allows us to construct custom fakes for our tests. If we'd prefer that a particular test not hit Redis, we can now do so quite easily.