Support the ongoing development of Laravel.io →
Authentication Testing
Last updated 2 weeks ago.
0

Dammit, so obvious. Yep that worked! Thanks DrPrez

Last updated 2 weeks ago.
0

So obvious someone erased the answer? But not so obvious that the answer is easily discoverable.

0

thomasedwards said:

Dammit, so obvious. Yep that worked! Thanks DrPrez

Looks like the answer was deleted.....could you post it for us?

0

You could just ensure that you log out the user before each test case - possibly with $this->flushSession() as found in Illuminate\Foundation\Testing\Concerns\InteractsWithSession.

However do each test cases not get executed separately from one another? If so using $this->be(...) with-in one test case shouldn't result in the user still being logged in on the next test case.

0
Auth::logout();

Was the original answer. Archive.org saves the day.

0

Sign in to participate in this thread!

LoadForge

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 Laravel.io - All rights reserved.