-
Notifications
You must be signed in to change notification settings - Fork 25
Description
First see laravel/framework#1181 for context.
What winds up happening is that NONE of the event listeners for any of the traits ever get called after the first unit test is run. I currently have to use the hack provided by this comment laravel/framework#1181 (comment) in order to run more than one test using esensi/model.
I am inheriting my models directly from Esensi\Model\SoftModel, so the Esensi\Model\Model::bootTraits is only ever called on the first unit test. While yes, this is an issue with Laravel as a whole, the team seems to be recommending against assigning event watchers in a model's boot sequence regardless and have opted not to fix this issue. Instead, the generally accepted "non-hack" requires moving all event registration to app/start/global.php as per laravel/framework#1181 (comment)
This issue should be stated somewhere in your documentation. Also, the project should provide a way to quickly register all the required event listeners for models in app/start/global.php instead of in the boot process which has this severe defect. At the very least there should be some examples of manually registering the listeners.