jeudi 20 juin 2019

Event testing in Laravel with sqlite in memory database

I have 5 tests and 14 assertions that all pass when I use a mysql database for testing. I make one single change in my .env.testing file from this:

DB_CONNECTION=mysql

To this:

DB_CONNECTION=sqlite

And I only get one failure, an event was not dispatched.

Here is the relevant sqlite config:

'sqlite' => [
        'driver' => 'sqlite',
        'database' => ':memory:',
        'prefix' => '',
    ],

The expected event is triggered directly with a helper like this event(new EventName()); and remember it works fine when mysql is used for the testing database.

What am I missing here!?

Aucun commentaire:

Enregistrer un commentaire