I'm creating a Laravel7 application.
Laravel application and PHPUnit are using sqlite as database.
For the development in my local I have configured as follows
// .env
DB_CONNECTION=sqlite
DB_DATABASE=/path/to/db.sqlite
// phpunit.xml
<server name="DB_CONNECTION" value="sqlite"/>
<server name="DB_DATABASE" value=":memory:"/>
Step 1: Register a new user and able to successfully login
Step 2: Execute the test and it executes successfully
Step 3: Again login to application but it shows SQLSTATE[HY000]: General error: 1 no such table: users (SQL: select * from "users" where "id" = 1 limit 1)
After executing the tests the existing tables are removed from the sqlite database even though the test's database is in memory
Note: In all my test classes I have use DatabaseMigrations;
to include the trait.
How can I solve this issue?