I am going through a Laracast tutorial which suggest me to have the statement use DatabaseTransactions;
inside my test class definition, to allow the data changes in my test case will persists only for that case.
I have a test class,
Class MyClassTest extends TestCase
{
// This use statement is responsible for
//all the data operations to persists only with in that test case
use DatabaseTransactions;
/**
* @test
*/
public function my_test_function()
{
// My test case code. Which inserts/updates
//data and assert statement.
}
}
The use DatabaseTransactions
works in a way that the data changes in the method persists only with in that. How that works exactly?