$session->
method('getUsageIndex'
)->
will($this->
onConsecutiveCalls(0, 1
));
$session->
method('getId'
)->
willReturn('123456'
);
$session->
method('getName'
)->
willReturn('PHPSESSID'
);
$session->
method('save'
);
$session->
method('isStarted'
)->
willReturn(true
);
if (isset($phpSessionOptions['samesite'
])) { ini_set('session.cookie_samesite',
$phpSessionOptions['samesite'
]);
} session_set_cookie_params(0,
$phpSessionOptions['path'
] ?? null,
$phpSessionOptions['domain'
] ?? null,
$phpSessionOptions['secure'
] ?? null,
$phpSessionOptions['httponly'
] ?? null
);
$listener =
new SessionListener(new Container(), false,
$sessionOptions);
$kernel =
$this->
createMock(HttpKernelInterface::
class);
$request =
new Request();
$listener->
onKernelRequest(new RequestEvent($kernel,
$request, HttpKernelInterface::MAIN_REQUEST
));
$request->
setSession($session);
$response =
new Response();
$listener->
onKernelResponse(new ResponseEvent($kernel,
$request, HttpKernelInterface::MAIN_REQUEST,
$response));
$cookies =
$response->headers->
getCookies();