How can I simulate logging out after using Passport::actingAs in a unit or integration test?
- 阅读更多 关于 How can I simulate logging out after using Passport::actingAs in a unit or integration test?
问题 I have a test where I simulate logging in, then afterwards I want to test things as if I was not logged in. Like so. // log in as user with id 2 $id = 2; Passport::actingAs(User::findOrFail($id)); testSomeStuff() ... // now I want to test things as if I was not logged in Is there a way to do this in one test function? I'm using Laravel 5.6 and Passport 5. 回答1: Try this in your test $this->refreshApplication(); Had the same issue and this is the only thing that worked for me EDIT: It seems to