samedi 26 septembre 2015

How to prevent Model events from firing using phpunit?

I want to prevent Model events such as 'created'. 'updated' etc when testing my application using phpunit.

In the documentation of Laravel it says that you can prevent events from firing by using

$this->expectsEvents(App\Events\UserRegistered::class);

But in my situation I have no class to expect.

I know that I can use $this->withoutEvents(); to prevent all events, but how can I prevent only specific model events?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire