Class TestSession

Read only access to the session during testing.

Namespace: Cake\TestSuite

Properties 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 $session)

Parameters

array|null $session

Session data.

check() public

check(?string $name)

Returns true if given variable name is set in session.

Parameters

string|null $name optional

Variable name to check for

Returns

bool

True if variable is there

read() public

read(?string $name)

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

The value of the session variable, null if session not available, session not started, or provided name not found in the session.

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.1/class-Cake.TestSuite.TestSession.html