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

Posted 7 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()

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


Reply to

Use Markdown with GitHub-flavored code blocks.