Better Testing in Laravel
summary
Advocates integration‑style tests over strict unit tests to maximize refactor confidence, trading some speed for readability over mock-heavy speedups. Recommends using a default payload and Laravel’s array_except helper plus data providers with generators and optional setup callbacks to cover required/invalid/unique validation cases without repetitive tests. Tests middleware by defining a dummy route inside the test, asserting behavior at the HTTP level, and using laravel test assertions to verify routes use the middleware while disabling it in route tests when setup is noisy.
AI-written summary · about
chapters (15)
- 0:00Intro
- 3:59Fast tests
- 4:46Reduce unnecessary details
- 5:21Testing
- 8:20Strings
- 13:28Specific Values
- 14:19Validation
- 16:02Validation Provider
- 18:59Incorrect Values
- 20:37Unique Email
- 21:17Setup Step
- 22:45Testing Middleware
- 23:42Why not use a route
- 28:47Test assertions
- 30:19Test middleware
related talks
52mLaravel Testing Tips, Techniques and Pitfalls
29mEffective tests and testing effectively
31mTesting With Fakes
35mContract Testing and Laravel: Reliability in APIs Between Microservices
26mBehaviour Driven Development with Laravel
38mLaravel Design Patterns
21mSoftware Design Patterns in Laravel 4
36mLiving peacefully with Laravel
