What is the difference between database migrations and transactions while unit testing in Lumen?

Solution:

DatabaseMigrations migrates the database when you run the test, then rollsback the dabase when test is finished.

DatabaseTransactions uses transactions. Any data inserted from your database will be rolledback after the test.

The difference between the two is DatabaseMigrations uses migrations (migrates your database migration then rolling it back after the test) while DatabaseTransactions uses the transaction (data inserted from the database are rolledback)

Source: https://mattstauffer.co/blog/better-integration-testing-in-laravel-5.1-databasemigrations-databasetransactions-and-withoutmiddleware