You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<?phpclass User extends Model {
use UuidModelTrait;
...
}
<?phpclass UserTest extends TestCase
{
publicfunctiontest_user_create_dispatches_event()
{
Event::fake();
User::create(['email' => 'foo@bar.com', 'password' => Hash::make('helloworld'));
// around here the error should appear,// if you comment `Event::fake()` and `Event::assertDispatched`// then the user should be created normally
Event::assertDispatched(MyEvent::class);
}
}
The text was updated successfully, but these errors were encountered:
Also try to report this to laravel/framework project, you may get some feedback whether this is an issue with the framework or if there are any clean solutions to it.
I'm trying to test event dispatching in my application using the PHPUnit tools provided by Laravel.
In a test where
Event::fake()
is called before creating a newModel
(aUser
for instance) the package's UUID trait's boot method seems to break.I get MySQL errors relating to field
id
not having a default value:I'm using Laravel 5.6 as my application base.
Trimmed example code to reproduce:
The text was updated successfully, but these errors were encountered: