~/talk

Practical Unit Testing in Laravel

Talkat Laracon Online Summer 2021 · on Wednesday, 2021-09-01· [php, testing]
links:none on file
slides:none on file

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

  1. 0:00Introduction to Laravel testing
  2. 2:47Testing framework components
  3. 8:28Side effects and fakes
  4. 11:15Unit testing notifications
  5. 13:22Testing event listeners
  6. 15:46Using test doubles
  7. 18:34Unit testing form requests
  8. 21:00Testing form requests in isolation
  9. 28:13Unit testing API resources
  10. 32:24Q&A and closing
~/search
type to search 8,222 conferences, 162,397 speakers and 219,688 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.