-
-
Notifications
You must be signed in to change notification settings - Fork 240
Events are not dispatching #903
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
Comments
@GeorgeInteli Hello. All events are sent when a transaction is committed. Add a check to your transaction level test, it must be 0 for the event to be sent. I'm sure the test will fail, because... pest starts a transaction before the test starts and ends it after the test ends. You need to call commit yourself before checking. |
Hello @rez1dent3 , I can confirm that even on transaction level 0 the events are not dispaching. Note that even if the events did fire i dont think reverting or commiting something outside the scope of the function is a solution. I am sure this was discussed before. Any best practices or solutions you might recommend? And what is the reasoning behind transaction level 0. I see it hard coded inside |
@GeorgeInteli The laravel architecture is such that if there is no listener, then the event is not sent. Here you can see the tests of the package: laravel-wallet/tests/Units/Domain/EventTest.php Lines 73 to 88 in e8c70cc
|
The transaction can be canceled and the event sent. |
I checked locally again. Events are sent. Need more data. |
@GeorgeInteli I didn't notice at first, but you're testing the implementation, not the interface. You need to check the contract itself, the trigger for it. |
As I already wrote above, you need to determine the listener. |
@GeorgeInteli Hello. I took some time and started debugging. The flush method is not implemented for Fake in laravel. You will not be able to implement your check. |
Thank you @rez1dent3 |
@GeorgeInteli You can use it in a similar way to the tests in the package itself. Those,
this will give you the ability to write tests. Look at the tests in the project: |
Describe the bug
The events from the package are not dispatching.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
After a deposit I expect to receive event on Balance change and Transaction created.
Screenshots

Here is sample test
Server:
The text was updated successfully, but these errors were encountered: