bentools/doctrine-static
Lightweight in-memory Doctrine mock for unit tests. Create ObjectManagers in a ManagerRegistry, persist/remove and flush to a temporary store, and use repository methods like find, findBy, findOneBy, and findAll. Not for real persistence.
Adopt if:
Look elsewhere if:
DatabaseTransactions instead.UnitOfWork, lifecycle callbacks, or metadata-driven features.For Executives: "This package is a game-changer for our development team’s efficiency. By replacing database-dependent tests with fast, in-memory mocks, we can cut test execution time by up to 80%—freeing up CI/CD resources and accelerating releases. For example, a feature requiring 5 test cases might take 2 hours to run with a real database but just 10 minutes with this tool. It’s a low-cost, high-impact investment to improve our velocity without adding technical debt. Most importantly, it reduces flaky tests caused by database issues, giving us more confidence in our code quality."
For Engineering (Developers/Architects):
"Doctrine Static lets us mock Doctrine’s EntityManager and Repository interfaces with simple arrays, making it trivial to test business logic without spinning up a database. It supports core operations like persist(), find(), and findBy(), which cover 90% of our test cases. While it doesn’t support advanced Doctrine features like UnitOfWork, it’s perfect for unit and integration tests where we need to validate repository interactions. Think of it as a ‘test double’ for Doctrine—lightweight, fast, and deterministic. Trade-off: We’ll need to manually seed mock data, but the speed and reliability gains outweigh the effort."
For QA/DevOps: "This tool will stabilize our CI pipeline by eliminating flaky tests caused by database inconsistencies. Since tests run in-memory, they’re faster and more predictable, reducing false positives and negatives. It’s especially useful for pre-commit hooks and nightly regression suites. We can also use it to simulate edge cases (e.g., large datasets) without hitting production-like loads, improving test coverage for performance-critical paths."
For Product Managers: "This enables us to iterate faster on features without worrying about database setup or test flakiness. For example, when A/B testing a new feature behind a flag, developers can write isolated tests using mock repositories, ensuring the logic works before integrating with the real database. It also helps us onboard new developers quicker by abstracting away database complexity, so they can focus on delivering value."
How can I help you explore Laravel packages today?