logo
podcast Podcast
get help Get Unstuck

Better mock assertions with Eloquent models

Nice and clean, the Laravel way

Joel Clermont
Joel Clermont
2025-04-25

I never really liked how verbose it was to assert that a mock was called with an Eloquent model. It always seemed like it should be easier.

In today's video, I will show the default way, which doesn't work, the verbose solution, and then the nice, clean solution, which is what I wanted from the beginning.

Watch Now (6 min)

And after watching, don't forget to subscribe to our YouTube channel, so you don't miss future videos.

Here to help,

Joel

P.S. This video went a bit deep into how Mockery matches arguments. If you want a really deep dive on Laravel's validation rules, check out our book.

Toss a coin in the jar if you found this helpful.
Want a tip like this in your inbox every weekday? Sign up below 👇🏼
email
No spam. Only real-world advice you can use.