Is there a way to make a setUp() and tearDown() method that tell laravel something like "make all of this insertions in Database, but when you finish all the tests, delete all insertions without reset the database"
I need to do tests like this:
/** @test */
public function testRegistration(){
$account = [
'name' => 'test',
'email' => 'test@gmail.com',
'password' => '123451234'
];
$this->visit('/register')
->type($account['name'],'name')
->type($account['email'],'email')
->type($account['password'],'password')
->type($account['password'],'password_confirmation')
->press('Register')
->seePageIs('/home');
}
At first, i can run phpunit
and it will work, if i run again, of course it returns an error telling me that i cannot use this email because already in the database.
The problem is that i can't simple reset my database, i have already 12.000 rows inserted in my database and i can't create a test_database because i need these 12.000 rows inserted to my application makes sense.
I haven't found any information that i can use, all that i can find is "make your test call migration::refresh and send 4 minutes to populate your table again", but i'm sure that is possible to find a better solution!
Also, where do i put my setUp() method and where do i call it?
Thank you.