darkec

Does RefreshDatabase rollback changes after each test of at the end of all

Posted 5 months ago by darkec

Let's say I have simple test with 2 functions:

public function testCreateUser()
{
    User::create(['username' => 'test']); 
}

And this is where I create a user and it has id=1.

Now I want to get that user in next test function

public function testGetUser()
{
    User::find(1); 
}

Will this user be in my database or will RefreshDatabase rollback my changes after it finishes with testCreateUser() so my user won't be saved in the database?

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.