macpaw/behat-messenger-context
Behat context for Symfony Messenger that lets you assert messages were dispatched, handled, or routed to specific transports during your scenarios. Integrates with Behat's step definitions to give readable, behavior-driven coverage of async messaging flows in PHP applications.
Architecture fit — Unchanged by v3.1.0. The package remains a Behat extension supplying context classes around Symfony Messenger: it wires the message bus into BDD scenarios and exposes assertions that a message was dispatched, handled, or carried the expected envelope. Laravel's equivalents are Bus::fake(), Queue::fake(), and Event::fake() under Pest/PHPUnit. Laravel does not use Symfony Messenger — Illuminate\Bus and the Laravel Queue are separate implementations. Fit remains conceptual, not direct: the package is only usable if the application adopts Behat and Symfony Messenger, both foreign to a conventional Laravel stack. Fit for our context: low.
Integration feasibility — Composer-level integration is still trivial (MIT, small dependency graph, v3.1.0 is a minor, non-breaking release over v3.0.1). Runtime integration is where it breaks down, as before: you would need to (a) bootstrap Behat into the Laravel app, (b) install and bind Symfony Messenger alongside Laravel's own bus, and (c) route the tested domains through Messenger rather than Laravel's dispatcher. That means two message buses in one container — a persistent source of confusion and false-green tests. The new per-scenario queue reset does not address the dual-bus problem, only intra-suite state bleed.
Technical risk
symfony/* ranges in its own composer.json — constraint conflicts remain likely at every Laravel upgrade.Key questions
Stack fit — Unchanged. Poor as a drop-in; good as a pattern donor. The value is the assertion API shape (assert dispatched count, assert handled, assert envelope contents), which maps cleanly onto Laravel's Bus::fake()/Queue::fake() assertions (assertDispatched, assertPushed, assertNothingDispatched). The v3.1.0 reset hook has a direct Laravel analogue: fakes are already re-instantiated per test method, so Laravel-native fakes get scenario isolation for free — reinforcing that Path A delivers the same guarantee without new tooling.
Migration path — Two viable routes, unchanged:
Compatibility — Verify the Symfony version matrix first. Laravel 10/11 pin Symfony components to 6.x/7.x ranges; confirm symfony/messenger satisfies existing constraints before adding anything. Check PHP version support against the runtime. Behat 3.x is stable but a quiet ecosystem compared with Pest/PHPUnit. v3.1.0 is a minor release with no documented breaking changes or deprecations, so no upgrade work is implied if the package were already in use — we are not using it, so this is informational only.
Sequencing
Illuminate\Bus confusingly.macpaw/behat-messenger-context against a ~100-line local context — now including the reset hook (PR #41) as part of the build-vs-buy surface.Maintenance — Still low if used as-is: small, MIT, thin. The real cost remains upstream drift with no dependents to surface breakage early. Plan to vendor or fork, and budget a review at every Symfony/Laravel major bump. v3.1.0 is additive and low-churn; two new contributors reduce (but do not eliminate) the single-maintainer exposure.
Support — Single-vendor (MacPaw), no commercial support, no dependent ecosystem to consult. Internal knowledge must be built and documented; the team's Behat and Symfony Messenger expertise is the actual dependency, not the package. The v3.1.0 docs update is a small plus for onboarding but does not create a support channel.
Scaling — Unchanged in principle: the concern is test-suite scaling, not runtime. Behat suites are slower and less parallel-friendly than Pest/PHPUnit in typical Laravel CI, and a second framework doubles the tooling surface (two runners, two assertion styles, two CI stages). v3.1.0's per-scenario reset meaningfully improves reliability of parallel/sharded runs by preventing cross-scenario message bleed, but does not change the runner-cost profile.
Failure modes
symfony/messenger blocking a Laravel upgrade.Ramp-up — Unchanged. Behat + Gherkin + Symfony Messenger is three unfamiliar layers for a typical Laravel team. Realistic ramp-up is weeks for comfortable contribution, not days. That cost must be weighed against the package's narrow value: assertion sugar, now with scenario-reset convenience, over a message bus Laravel does not use.
Recommendation — Do not adopt as a production dependency. Harvest the assertion pattern into Laravel-native fakes (Bus::fake()/Queue::fake()), which delivers the same testing value — including automatic per-test isolation — at effectively zero integration and maintenance cost. v3.1.0 is a genuine quality-of-life improvement and a positive activity signal, but it reinforces rather than changes the conclusion. Revisit only if the organization commits to Behat as a cross-stack standard — and in that case, prototype behind a PoC branch with an explicit budget for a maintained fork.
How can I help you explore Laravel packages today?