samedi 6 janvier 2018

SQLite unable to open database file when testing with Lumen

I'm trying to set up SQLite for testing. I saw a lot of solutions but none of them worked. So here I'm. This is what I've done :

1- Create the sqlite file

sqlite3 database/database.sqlite

2- Set up the env variables in the phpunit.xml file

<env name="APP_ENV" value="testing"/>
<env name="CACHE_DRIVER" value="array"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="QUEUE_DRIVER" value="sync"/>
<env name="DB_CONNECTION" value="sqlite"/>
<env name="DB_DATABASE" value="database"/> <!-- because in my .env I have redefined DB_DATABASE -->

But all I get is this error :

Illuminate\Database\QueryException: SQLSTATE[HY000] [14] unable to open database file (SQL: select * from sqlite_master where type = 'table' and name = migrations)

Does somebody know why?

Aucun commentaire:

Enregistrer un commentaire