Fixture Factories Plugin
summary
Plugin that replaces CakePHP fixtures with factory classes that create entities on the fly and return entity objects by default, avoiding database writes unless persist is called — no persisted DB writes. It auto-wires associations via the ORM, offers chainable business methods (eg. withPermission("foo")), and uses a migrator that runs real migrations and truncates dirty tables so test schema matches production. Works on MySQL/Postgres/SQLite and is compatible with CakePHP 3 and 4; non-persisted tests run near-zero extra time versus legacy fixtures.
AI-written summary · about
chapters (13)
- 0:00Introduction to Fixture Factories
- 1:09Problem with Static Fixtures
- 3:01Fixture Factories Concept
- 5:49Good Testing Practices
- 10:33Plugin Setup and Installation
- 13:22Creating Factory Classes
- 17:00Why Factories for Big Projects
- 18:24Test Life Cycle and Migrations
- 19:29Performance Comparison
- 21:36Compatibility and Database Support
- 22:17Live Coding Demo
- 27:15Writing Behat Tests
- 30:46Conclusion and Q&A
