Session data in phpunittest

@webdeveloper
Tue, 03 Sep 2024 14:17:14 +0000

webdeveloper:

dd($_SESSION);

Thank you.

Even then I don’t see the session I set

$this->session(['Auth.User.user_id' => 5]);
$this->enableRetainFlashMessages();
$this->get(['prefix' => 'XXX', 'controller' => 'ControllerName', 'action' => 'actionName']);
dd($_SESSION);

debug: I get only the flash message from actionName method

PHPUnit 9.6.19 by Sebastian Bergmann and contributors.

...S^ array:1 [
  "Flash" => array:1 [
    "flash" => array:1 [
      0 => array:4 [
        "message" => "Invalid course code"
        "key" => "flash"
        "element" => "flash/error"
        "params" => []
      ]
    ]
  ]
]