Reputation: 8560
I have code for testing :
public function setUp()
{
parent::setUp();
Session::setId('test');
}
public function testInitialize()
{
echo Session::getId() . "\n";
}
and output in testInitialize function is:
bf7535b20443fd1302e2aa27a917a885b522e320
I assume that once laravel sets the session id it can't be set up again, but does somebody have snippet how to destroy session and set up again so the output in testInitialize() will be :
test
Upvotes: 1
Views: 2046
Reputation: 21
session ID has to be 40 characters in length, try setId('<40 digits characters>'), or else laravel by default will auto generate one for you.
Hope that helps.
Upvotes: 2
Reputation: 3795
To regenerate the session ID, use the regenerate method.
Session::regenerate();
Upvotes: 0