dama/doctrine-test-bundle
A Symfony bundle that speeds up Doctrine tests by wrapping DBAL connections in a static driver and rolling back a transaction after each test, keeping tests isolated without schema rebuilds or fixture reloads. It also configures a PSR-6 static array cache.
#[SkipDatabaseRollback] for edge cases like debugging).Adopt if:
INSERT/UPDATE conflicts) or leaked transactions — v8.7.0's new warning surfaces the latter automatically.Look Elsewhere if:
ALTER TABLE) that can’t be rolled back (use temporary test databases instead).AUTOCOMMIT=1; configure use_savepoints: true or refactor)."This package cuts test suite runtime by 50–80% by eliminating redundant database operations. For a team running 2,000 tests daily, that’s ~10–15 hours saved per week in CI costs—equivalent to 2 full-time engineers. It’s a zero-risk upgrade (MIT-licensed, used by Symfony’s demo app) that improves reliability while reducing infrastructure costs. No code changes needed; just install and enable. The newest release is a drop-in minor version that keeps us current with PHPUnit 13 and Behat 4, and adds automatic warnings for unclosed transactions — the kind of hidden defect that causes flaky builds and wasted engineering hours."
Key Outcomes: ✅ Faster releases: Shorter CI feedback loops. ✅ More reliable tests: No flakiness from shared state; leaked transactions now flagged. ✅ Lower cloud costs: Fewer failed retries due to timeouts. ✅ Future-proof: Current with PHPUnit 13, Behat 4, and modern PHP/Symfony stacks.
*"The DAMA Doctrine Test Bundle replaces manual transaction management with a smart, configurable wrapper that:
#[SkipDatabaseRollback]).Implementation:
composer.json (dev dependency) — pin to ^8.7.bundles.php and phpunit.xml.use_savepoints: true in Doctrine DBAL (if using DBAL <4).Trade-offs:
Next Steps:
How can I help you explore Laravel packages today?