DEV Community

Kerry Owston
Kerry Owston

Posted on

Users table wiped out after testing.

After switching to SQLite and I was wondering why I can't authenticate when trying to log in via Postman.

Since everything was working fine before I started building out my tests this morning.

But suddenly I'm looking at an empty users table where previously there had been several - test users.

The culprit...

phpunit.xml

    <php>
        <env name="APP_ENV" value="testing"/>
        <env name="APP_MAINTENANCE_DRIVER" value="file"/>
        <env name="BCRYPT_ROUNDS" value="4"/>
        <env name="CACHE_STORE" value="array"/>
        <!-- <env name="DB_CONNECTION" value="sqlite"/> -->
        <!-- <env name="DB_DATABASE" value=":memory:"/> -->
        <env name="MAIL_MAILER" value="array"/>
        <env name="PULSE_ENABLED" value="false"/>
        <env name="QUEUE_CONNECTION" value="sync"/>
        <env name="SESSION_DRIVER" value="array"/>
        <env name="TELESCOPE_ENABLED" value="false"/>
    </php>
Enter fullscreen mode Exit fullscreen mode

Simple fix:

<!-- -->
<!-- -->

Now I no longer experience a wipeout on my db user tables.

Now each test run is on a fresh isolated instance of the database and will not interfere with my project's live data.

Top comments (0)