Closed minthemiddle closed 4 years ago
@minthemiddle, thanks for this. I've created a pull request to address it. As I've done it, events will continue to fire after the model is created, but during creation, no events will fire. This should assure that you can use the models as expected after world-building.
In some tests, you may have side-effect events that you might want to switch off. An example is mails that are being sent after a model creation. You might not want to assert them with every test on this model.
I'm using a Factory macro by Paulund to append
->disableEvents()
to all factories where I don't want the events to fire.It would be nice to have an
disableEvents()
orwithouthEvents()
(seems closer to your naming schema) for Poser.So it would result in:
UserFactory::new()->withoutEvents()->create();