Laravel Factories Reloaded
summary
Demo recipe platform uses real models (users, recipes, categories, contests) and three concrete tests: published flag, owner access, and sending contest report. Tests create the data via Laravel factories and a new package that generates class-based factories with chainable APIs like with() and times(). The demo builds contest data (owner, category, 10 participants, each with 3 recipes), calls a preparedForReport flow, and shows all tests passing using notification fakes — implementation and package work end to end.
AI-written summary · about
chapters (14)
- 0:00Introduction and welcome
- 1:05About the speaker and talk
- 3:34Demo app overview
- 5:01Introduction to model factories
- 8:55Writing first test with factories
- 13:11Testing unpublished recipes access
- 16:41Testing contest report notifications
- 25:29Issues with default factory approach
- 31:07Class-based factories introduction
- 39:15Building custom factory classes
- 41:46Implementing user factory
- 45:19Refactoring contest test
- 54:50Advantages of class-based factories
- 56:36Summary and closing remarks
