insert those in your phpunit.xml
<env name="DB_CONNECTION" value="sqlite"/>
<env name="DB_DATABASE" value=":memory:"/>
I've been trying for a little while now to set up a testing database in laravel 5.4 If there are any up to date resources on doing this I would like to see it. I am wondering if a lot of the resources I have tried are obsolete.
Firstly, I am correct that once I setup the sqlite database for testing I do need to run migrations? Because thats when I am hitting my errors. As long as this is so lets proceed.
Are there any specific configurations I need to put in phpunit.xml???
I leave my .env alone correct? Do I need a .env.testing?
I did make one
APP_ENV=testing
APP_DEBUG=true
APP_LOG_LEVEL=debug
DB_HOST=127.0.0.1
DB_CONNECTION=sqlite.testing
or do I just update my config/database.php
'sqlite_testing' => [
'driver' => 'sqlite',
'database' => storage_path().'/database.sqlite',
'prefix' => '',
],
I have tried several other paths such as the default
'database' => env('DB_DATABASE', database_path('database.sqlite')),
don't remember the exact variations I tried but I tried several. And I created the file in those locations when I tried it. One error I got while trying it that second way was "couldnt write to file" or something like that, so I changed permissions to try 777 but still got the same.
My current error message is "sqlite.testing" not configured.
Seems like something that should be easy but its giving me a bunch of trouble, any help would be appreciated. Ultimately I'd like the fastest setup so I would probably like the in memory sqlite setting if you can focus your answer towards that!
Please or to participate in this conversation.