Black Friday: the Laravel testing course is $149 instead of $249, through Dec 7. See the course →
logo

Watch out for this when testing Artisan commands

A weird reason for a failing test

Joel Clermont
Joel Clermont
2026-07-10

From our daily Laravel tips email. Get the next one in your inbox.

A small change to how you write an Artisan command test can make it fail, even though the command itself works perfectly.

In this video, I make one innocent-looking refactor to a real test, watch the assertions fall apart, and then dig into the framework source to understand why the command never actually ran.

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. Build up your testing skills by adding tests to a non-trivial application in our testing workshop.

Want a tip like this in your inbox every weekday?

Each one takes less than 2 minutes to read. Join 4,000+ Laravel developers who already get them.

email
No spam. Only real-world advice.
Toss a coin in the jar if you found this helpful.