#Set DB_CONNECTION to use sqlite in-memory database when testing
- Open `phpunit.xml' file in the current project
- Add the following environment variables to the appropriate section
<env name="DB_CONNECTION" value="sqlite">
<env name="DB_DATABASE" value=":memory:">
- in
config\database.php
file, change the defaultsqlite
connection to
'connections' => [
'driver' => 'sqlite',
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '',
],
I think the environment tags in the
phpunit.xml
file should autoclose, otherwise, you're going to receive some sort of error like the followingNo problem when you add the
/
character to close the tags