Closed brenjt closed 9 years ago
Can you provide an example of your model + tests? Can't really help otherwise. Creating should only get called once - when the model object is originally "created". And this only happens if the model has no id and $exists is false.
It looks like this is the real issue here. https://github.com/laravel/framework/issues/1181
Okay closing as it appears as though it's something else :)
Yeah when it came down to it, the problem was Laravel not calling the events again during unit tests. Although it appeared that the issue was on UUID model it is in fact on Laravel. Not much one can do until it's fixed with them.
Is there a solution for this? static::creating callback is never called on a phpunit test by default so the UUID is never generated when performing tests.
When testing models with phpunit. I get an
Field 'id' doesn't have a default value
. For some reason all second tests fail when creating theid
. It looks like thestatic::creating
callback is never getting called the second time. This is only prevalent in unit testing and not in regular laravel. Thoughts?