test: add event Listen/Dispatch integration coverage (framework#1541) - #156
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
facades.Event().Listen()/Dispatch()API: string events with payloads, wildcard matching and ordering, typed and plain closures, slice registrations, aggregatedResulterrors, listener/event panic recovery, registration validation, and concurrent dispatch.Register/Job/GetEventspath as well, pinning its coexistence withListen, name-based event identity, wildcard matching, and queued delivery so the legacy contract stays regression-tested until it is removed.Handle(the matched name, never the pattern).Closes https://github.com/goravel/goravel/issues/1541
Why
framework#1541 replaced the
Register/Jobflow withListen/Dispatchand aResultthat joins every listener error, and the example was adapted to the newHandle(eventName string, args ...any)contract in #150. The event feature suite, though, only exercised event-value dispatch and a handful of deprecated paths, leaving the new surface — wildcards, closure forms, slice registrations, validation, panic recovery, and concurrency — without end-to-end coverage. This PR adds that integration coverage, plus the deprecated path that still ships, all through the real application container and its database-backed queue worker.The tests lock in the semantics the migration depends on: an event with no listeners is a silent success, every matching listener runs with its failures aggregated into
Result, a panicking listener or event is recovered and reported rather than crashing the request, and queued listeners receive the canonical event name ahead of the payload. They also confirm the deprecatedRegister/JobAPIs still resolve listeners registered through the newListen, so the two surfaces coexist safely during the deprecation window.