W3cubDocs

/CakePHP 4.4

Class TestSession

Read only access to the session during testing.

Namespace: Cake\TestSuite

Property Summary

Method Summary

  • __construct() public
  • check() public

    Returns true if given variable name is set in session.

  • read() public

    Returns given session variable, or all of them, if no parameters given.

Method Detail

__construct() public

__construct(array|null $session)

Parameters

array|null $session

Session data.

check() public

check(string|null $name = null): bool

Returns true if given variable name is set in session.

Parameters

string|null $name optional

Variable name to check for

Returns

bool

read() public

read(string|null $name = null): mixed

Returns given session variable, or all of them, if no parameters given.

Parameters

string|null $name optional

The name of the session variable (or a path as sent to Hash.extract)

Returns

mixed

Property Detail

$session protected

Type

array|null

© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/4.4/class-Cake.TestSuite.TestSession.html