Practical Unit Testing in Laravel
summary
Argues that feature tests shouldn’t be the only tool and shows concrete unit-test targets: middleware tested by calling handle with a no-op next, notifications tested via toDatabase and toMail methods, listeners and jobs tested in isolation, and form requests validated with a custom validatesRequests trait plus TestFormRequest/TestValidationResult (shared as a gist) that lets requests be unit-tested instead of running full feature flows. Demonstrates Laravel fakes, app->swap, toResponse + TestResponse macro, and notes validation had required six duplicate feature runs before this approach.
AI-written summary · about
