Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

martingg88's avatar

Session issue for Unit testing

I have created test case and that have two issues. I would be appreciated if someone can help to solved this issue thanks.

session is not persisted across the multiple calls/routes "assertSessionHasErrors" doesn't work as "errors" key is not stored in $this->app['session.store']. However "errors" key exists in session()->all().

public function testFailSignup(){ $getResponse = $this->route('GET', 'signup'); $postResponse = $this->route('POST', 'submitSignup', [], []); $this->assertSessionHasErrors(); }

0 likes
5 replies
martingg88's avatar

I tried to changed that but still doesn't work. any idea? thanks

martingg88's avatar

I found out two route requests have it own session state by investigation on session id. What can I do to allow two requests share the same session?

Please or to participate in this conversation.