Session data in phpunittest

@webdeveloper
Tue, 03 Sep 2024 14:36:09 +0000

In my behavior.php file, I use the below to check the session variable I set in test

if (isset($_SESSION['Auth']['User']['user_id'])) {

test method:

 $this->session(['Auth.User.user_id' => 5]);

How can I rewrite this since $this->session will not be writing to $_SESSION