-
Notifications
You must be signed in to change notification settings - Fork 460
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
Testing a baum model and boot function #25
Comments
I understand that the I'm not sure if I should go down this path but a possible solution could be to override the Model methods for save, update, ... instead of relying on the events to get fired. Is this still an ongoing problem? Does it fail outside a testing environment? |
I see from the thread you linked (laravel/framework#1181) that the proposed solution is something similar to what you do but instead of calling the static |
I'm closing this issue right now as there are some workarounds to this (as suggested on thread you point out) and I'm quite unsure on how I should be fixing this from our end. Feel free to reopen if something relating this pops out on your radar or if you think there's something I should be adding to the library regarding this problem. Thanks. |
I ran into the same issue while trying to run tests. Thankfully found this thread. I used the same workaround by running Category::boot() in the setUp() method for any tests having to do with the Category class. |
Hey,
was just fighting with my very simple test function for my CategoryRepository (which extends my category node model) for two hours.
What I was trying to do:
Setup a simple category structure for testing within the setUp() test function. This works on the first test but if it comes to my second test the initialization of my test data it is not!
I found out it belongs to the way of binding the creating event within the boot function of Node.php .
Actually I have no idea if there is a better way for baum. I got it working for me by adding
CategoryRepository::boot();
within the setUp() of my CategoryRepositoryTest ...
This also belongs to this topic: laravel/framework#1181
The text was updated successfully, but these errors were encountered: