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

Mockdoctrinemanager Laravel Package

yosimitso/mockdoctrinemanager

A lightweight testing helper that mocks the Doctrine manager so you can unit test persistence-dependent code without a real database. Swap in the mock to stub repository lookups, flush and transaction calls, keeping tests fast and isolated.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Test strategy and QA investment: This package is a test-spy for Doctrine's EntityManager in a Laravel context. It lets teams assert what a service did — what was persisted, flushed, removed, and whether a transaction was begun, committed, or rolled back — without touching a real database. That informs decisions about unit vs. integration test ratios and how much DB-backed test infrastructure you fund.
  • Build vs. buy for test scaffolding: If teams are hand-rolling EntityManager mocks/spies per project, this is a candidate to standardize and delete internal test boilerplate.
  • Transaction correctness coverage: The hasBegunTransaction / hasComitted / hasRolledback surface supports explicit tests for rollback-on-failure behavior, which is usually under-tested and high-blast-radius.
  • Ordering assertions: The positional getters (getPersistedEntity($className, $position)) imply support for asserting the sequence of write operations, not just their occurrence — useful for services with multi-step persistence.
  • Roadmap signal, not a product feature: This is developer-productivity/platform tooling. It should be evaluated under DX and engineering-enablement roadmap lines, not customer-facing roadmap. v1.0 explicitly scopes to "most current operations," so plan for the API to grow rather than assume it is complete.
  • Primary use cases: unit tests for services/repositories that call persist/flush/remove, transaction-boundary regression tests, and contract tests around persistence ordering.

When to Consider This Package

Adopt when:

  • You use Doctrine ORM (or a Doctrine-like EntityManager) inside Laravel — the API is Doctrine-shaped (persist, flush, remove, transactional), not Eloquent-shaped.
  • You want fast, database-free unit tests for services that persist and flush entities.
  • You need to assert transaction lifecycle (begin/commit/rollback), especially failure paths.
  • You want positional assertions on the sequence of persistence operations.
  • You are comfortable piloting a young dependency and can wrap it behind an internal test helper.

Look elsewhere / proceed with caution when:

  • Your stack is Eloquent-only. persist/flush/remove do not map onto Eloquent, and the package will not fit typical Laravel Model::save() code paths.
  • You need broader EntityManager coverage. v1.0 covers only the listed operations — no find, merge, detach, refresh, getRepository, or query-builder interaction. If your services call those, the spy will not see them.
  • You need real database semantics. A spy cannot validate constraints, cascades, generated SQL, or query correctness. Keep integration tests for anything where the database is the thing under test.
  • You need maturity and community support. The release notes describe the package as new, with limited docs and adoption. Expect API churn.
  • You need strict typing. Return types shown as mixed and boolean (and the hasComitted spelling) suggest a loose signature surface; verify actual signatures before relying on IDE/static-analysis ergonomics.

How to Pitch It (Stakeholders)

For executives: This is a small, low-cost developer-productivity library that makes tests for database-writing code faster and more precise. It lets engineers verify in milliseconds that a service persisted the right entities, in the right order, and committed or rolled back as intended — instead of standing up a database for every test. It is a v1.0 with a deliberately narrow scope, so treat it as a low-risk pilot rather than a platform standard: trial it in one team, and keep the option to fork or fall back to in-house test doubles. It has no production runtime footprint and no customer-facing impact.

For engineering: A Doctrine EntityManager test spy for Laravel. Exposes getPersistedEntity / getRemovedEntity / getFlushedEntity (positional), plural getters, and hasBegunTransaction / hasComitted / hasRolledback, covering persist, flush, remove, beginTransaction, commit, rollback, and transactional. It fits services and repositories that talk to Doctrine where you want no-database unit tests plus explicit transaction-boundary assertions. Known gaps to plan around: v1.0 immaturity, operation coverage limited to the listed calls, loose-looking return types, a hasComitted spelling inconsistency, and no validation of real DB semantics. Recommendation: pilot in one service's suite behind our own thin test-helper wrapper so we can extend it, swap it, or replace it without touching test call sites.

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.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource