-
Notifications
You must be signed in to change notification settings - Fork 11.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamically Registered Event Listeners assertListening
Fails
#41771
Comments
assertListening
FailsassertListening
Fails
Heya, thanks for reporting. We'll need more info and/or code to debug this further. Can you please create a repository with the command below, commit the code that reproduces the issue as separate commits on the main/master branch and share the repository here? Please make sure that you have the latest version of the Laravel installer in order to run this command. Please also make sure you have both Git & the GitHub CLI tool properly set up. laravel new bug-report --github="--public" Please do not amend and create a separate commit with your custom changes. After you've posted the repository, we'll try to reproduce the issue. Thanks! |
Hey @gofish543. Feel free to provide that repo and I'll re-open. |
I'll get something up late tonight or tomorrow. You'll have it Monday. |
@driesvints Scratch that... |
Thanks @gofish543. I managed to reproduce this. I've sent in a PR for this: #41820 |
@driesvints Lovely! Thank you. |
Description:
A dynamically registered event listener using the
EventServiceProvider@shouldDiscoverEvents => returns true
registers the listener in the dispatcher as astring
value.This is fine, and the listener fires correctly. However, if a call is made to the
EventFake@assertListening(...)
, it will fail because the$actualListener
variable is a stringclass@method
syntax not matching any of the equals statements found.Steps To Reproduce:
REGISTERED DYNAMICALLY
and the EventServiceProvider...
assertListening
Observe the test case failing
Navigate to the file throwing the error
Illuminate/Support/Testing/Fakes/EventFake.php
line58
Dump the
$actualListener
and$expectedListener
variables (We can assume a string is never an instance ofClosure
orClosure::class
so we need the$actualListener === $expectedListener
to work)The text was updated successfully, but these errors were encountered: