Hey, I have a booking system and created a simplistic testBooking class with 3-4 methods that each test different scenarios. If I run them separetly in PHPStorm, each method with a created $booking class I can $booking->delete(). But when I run the whole testBooking class at once No $booking->delete()'s are fired...Nor is the event listeners I have for registered.
Is this a known issue? I've googled some of it and found there are issues, but that a model can't even ->delete()'ed?
Anyone?
Btw, I do have set a function in TestCase that loops all models and flush listeners. But, no difference.
This was discussed in https://github.com/laravel/framework/issues/1181 but that is no longer there now :(.
My solution involved using:
Model::flushEventListeners(); Model::boot();
before each test. If you are only flushing the listeners I would expect it to not work.
How you do this is up to you. I just ended up putting it in __before() but I havent needed to copy that into very many tests yet.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community