laravel / browser-kit-testing

Provides backwards compatibility for BrowserKit testing in the latest Laravel release.
MIT License
508 stars 75 forks source link

Event & Job Testing is not backwards compatible (Laravel 5.3 --> 5.4) #28

Closed Jonnx closed 5 years ago

Jonnx commented 7 years ago

Noticed an issue when running our legacy tests that when logic fires both events and dispatches queue jobs: the event listeners will not fire if there are calls for expecting queue jobs.

Example:

1) event should fire with non-queued listener to update additional fields 2) more logic happens, eventually the desired state is achieved 3) an queue job is dispatched to do something with this state (email, sms, push...)

Test:

1) we need to let the events & listeners propagate to ensure the correct state is achieved and just want to assert that the (email, sms, push, ...) job is dispatched so we use the $this->expectsJobs(...) 2) when running the tests, the event fire happens but the listeners do not run

Since there are changes with how events are "fired" using the "dispatch" method in the migration from Laravel 5.3 to 5.4, this may not be fixable but i thought i would bring it up since the laravel documentation states that the BrowserKitTestCase is fully backwards compatible

driesvints commented 5 years ago

Closing this issue because it's already solved, old or not relevant anymore. Feel free to reply if you're still experiencing this issue.