Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Doctrine Static Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Accelerate Test Velocity: Reduces test execution time by eliminating database dependencies, enabling faster feedback loops in CI/CD pipelines and local development.
  • Enhance Test Isolation: Provides deterministic, in-memory mocks for Doctrine ORM, eliminating flaky tests caused by database inconsistencies or external services.
  • Support Hybrid Architectures: Ideal for Laravel applications using Doctrine ORM alongside Eloquent, allowing teams to test Doctrine-specific logic without database overhead.
  • Simplify Onboarding: Lowers the barrier for new developers by abstracting database setup, focusing testing efforts on business logic rather than infrastructure.
  • Enable Feature Flag Testing: Facilitates isolated testing of features behind flags by mocking repository interactions without triggering real database operations.
  • Build vs. Buy Decision: Justifies avoiding custom mocking solutions by providing a lightweight, maintained alternative for Doctrine ORM testing.
  • Microservices Strategy: Supports testing microservices in isolation before integrating with real databases, reducing coupling and improving modularity.

When to Consider This Package

  • Adopt if:

    • Your team relies on Doctrine ORM for critical business logic and struggles with slow or unreliable database tests.
    • You need fast, deterministic unit/integration tests for repository-level operations (e.g., CRUD, queries).
    • Your application uses complex entity relationships that are cumbersome to mock manually.
    • You’re developing prototype features or spikes where database setup is impractical.
    • Your CI/CD pipeline is bottlenecked by database-heavy test suites.
    • You want to decouple testing from database dependencies while maintaining high test coverage.
  • Look elsewhere if:

    • Your primary ORM is Eloquent (Laravel’s native ORM), and you don’t need Doctrine-specific mocks. Use Laravel’s built-in mocking or DatabaseTransactions instead.
    • You require full Doctrine ORM compatibility, including UnitOfWork, lifecycle callbacks, or metadata-driven features.
    • Your tests depend on database-specific behaviors (e.g., transactions, stored procedures, or triggers).
    • You need persistent mock data across test runs (this package is in-memory only).
    • Your team prefers behavior-driven development (BDD) with tools like Symfony Panther or Laravel Dusk for end-to-end testing.
    • You’re using Doctrine extensions (e.g., behaviors, event listeners) that aren’t supported by this package.

How to Pitch It (Stakeholders)

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."

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel
draftsmaninc/draftsman
square-bit/laravel-volition
himito/laravel-mailman
htinlynn/genius-helper
maco-studios/hephaestus
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log