Maybe you can incorporate this with onUserLogin()
Jan 31, 2017
5
Level 5
Laravel Dusk with Session Data
I have some middleware that checks certain things for the user. If the user is logged in normally, this stuff is loaded into the session. Logging them in with Dusk's handy loginAs method bypasses this functionality, which is fine. However I need to load some info manually into the session.
Normal phpunit testing allows me to do something like $this->withSession(['foo' => 'bar]);. But I can't figure out how to do this with Dusk. I would like to avoid logging in normally for every test, but if I can't get this solved, I will have to do that.
Anyone have some solutions?
Please or to participate in this conversation.