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

Behat Messenger Context Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Test strategy for asynchronous workflows. This package lets Behat scenarios assert on Symfony Messenger behavior—that a message was dispatched, routed to the right transport, or handled—turning "the email is queued" from an untested assumption into an executable acceptance criterion. As of v3.1.0 it also resets message queues before each scenario, which is the feature that makes those assertions trustworthy at suite scale: without per-scenario isolation, one scenario's leftover messages can leak into the next and produce the intermittent acceptance-test failures that erode confidence in CI.
  • Build vs. buy for test infrastructure. Any team running Behat + Messenger faces the same chore: hand-rolling a context with steps for dispatch, transport inspection, consumption—and now queue cleanup between scenarios. Adopting this package is a small, MIT-licensed shortcut that lets you spend engineering time on product scenarios instead of harness plumbing. The isolation step in v3.1.0 is precisely the kind of detail teams forget to build until flakiness forces the issue.
  • CI pipeline and release-gating decisions. Adding Messenger assertions to acceptance tests changes what "green" means—it lets you gate merges on end-to-end message flow, which affects whether you can safely ship consumer changes independently of producers. Reliable per-scenario queue state is a precondition for making that gate deterministic rather than probabilistic; v3.1.0 materially strengthens the case for treating this suite as a release gate.
  • Roadmap sequencing. If BDD coverage of messaging is a prerequisite for a larger async/event-driven initiative, this package lowers the cost of that prerequisite and can pull the initiative forward. If your acceptance suite is thin, adopting it implies a commitment to expanding Behat coverage that should be resourced deliberately.
  • Use cases it unblocks: verifying producer→consumer contracts, regression-testing retry/failure behavior, asserting clean state between scenarios so ordering-sensitive tests stay reproducible, and documenting messaging behavior in business-readable Gherkin for non-engineering stakeholders.

When to Consider This Package

Adopt when:

  • You are on Symfony Messenger (not Laravel's queue system) and already run Behat for acceptance testing—this is the intersection where the package has value, and it is narrow.
  • You need BDD-readable assertions about message dispatch and handling, plus automatic queue reset between scenarios, and the alternative is writing and maintaining that context yourself.
  • You are comfortable with a small, single-maintainer-adjacent dependency: 17 stars, zero dependents, last release April 2025. It is niche but not abandoned, and v3.1.0 adds two first-time contributors—a mildly positive maintenance signal, not a guarantee.

Look elsewhere when:

  • You are on Laravel. Laravel's queue and bus abstractions are not Symfony Messenger; Bus::fake() and Queue::fake() in PHPUnit/Pest are the idiomatic path, and this package will not integrate. Do not let the "PHP package" framing obscure this—the new queue-reset step does not change it.
  • Your suite is PHPUnit/Pest-only. Adding Behat to gain this context is a large architectural decision that should not be driven by one helper package.
  • You need guarantees of long-term maintenance. With zero dependents and low adoption, treat it as code you may need to fork; budget accordingly or vendor it.
  • Your messaging surface is trivial—a single synchronous handler does not justify new test tooling.

How to Pitch It (Stakeholders)

For executives: This is a small, free (MIT) open-source helper that makes our automated tests able to check whether background messages—emails, webhooks, order events—are actually being sent and processed correctly. Its latest release adds automatic cleanup between test scenarios, which is the fix for the "tests pass locally, fail in CI" class of async test flakiness. It reduces the amount of custom test code we write and maintain, and lets us catch async failures before customers do. The cost is near zero; the risk is that it is a low-adoption library, so we should plan to own a copy if it stalls.

For engineering: It is a Behat context for Symfony Messenger—steps for asserting dispatch, transport routing, and consumption in acceptance tests, now with per-scenario queue reset so state does not bleed between scenarios. That saves us writing both the harness and the cleanup logic. Scope caveat stands: only relevant if we are on Symfony Messenger and Behat; on Laravel, Bus::fake()/Queue::fake() remain the answer. Given 17 stars and no dependents, evaluate it as a starting point, be prepared to vendor or fork, and pin the version in composer (3.1.0).

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.
skyraptor/chatter
edlugz/sasapay
abbasudo/artisan-route
mirvan/ippanel
ignibyte/aic-framework
glavweb/data-schema-bundle
glavweb/datagrid-bundle
tacticmedia/scim-server
uni-method/frame
neika-ai/sdk
adachsoft/php-code-style
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
adachsoft/api-version-bundle
cgv/localized-resource