Laravel 5 Testing with phpUnit without reset my database Laravel 5 Testing with phpUnit without reset my database database database

Laravel 5 Testing with phpUnit without reset my database


See this and this documentation (working with transaction).

This trait will only wrap the default database connection in a transaction.

In other words, the insertion will be "faked" so you will not need to remove it everytime.

Another option is to add another test in which you delete every insertion you have made.

User::where('name', 'test')->where('email','test@gmail.com')->delete();