PHP Class phpbb_session_testable_factory

The session class has rather complex dependencies, so in order to make its tests more * understandable and to make its dependencies more visible this factory class sets up all the necessary global state & variable contents.
Datei anzeigen Open project: phpbb/phpbb Class Usage Examples

Protected Properties

Property Type Description
$cache
$cache_data
$config
$config_data
$container
$cookies
$request

Public Methods

Method Description
__construct ( ) Initialises the factory with a set of default config and cache values.
check ( PHPUnit_Framework_Assert $test ) Check if the cache used for the generated session contains correct data.
get_cache_data ( ) : array Retrieve the entire cache data to be passed to the session.
get_config_data ( ) : array Retrieve the entire config data to be passed to the session.
get_server_data ( ) : array Retrieve all server variables to be passed to the session.
get_session ( phpbb\db\driver\driver_interface $dbal ) : phpbb_mock_session_testable Retrieve the configured session class instance
merge_cache_data ( array $cache_data ) Merge the cache contents with more data.
merge_config_data ( array $config_data ) Merge config data with the current config data to be supplied to session.
merge_server_data ( array $server_data ) Merge the current server info ($_SERVER) with more data.
merge_test_data ( $session_id, $user_id, $user_agent, $ip, integer $time ) Set cookies, merge config and server data in one step.
set_cookies ( array $cookies ) Set the cookies which should be present in the request data.

Method Details

__construct() public method

Initialises the factory with a set of default config and cache values.
public __construct ( )

check() public method

Check if the cache used for the generated session contains correct data.
public check ( PHPUnit_Framework_Assert $test )
$test PHPUnit_Framework_Assert The test case to call assert methods on

get_cache_data() public method

Retrieve the entire cache data to be passed to the session.
public get_cache_data ( ) : array
return array Cache contents

get_config_data() public method

Retrieve the entire config data to be passed to the session.
public get_config_data ( ) : array
return array Configuration

get_server_data() public method

Retrieve all server variables to be passed to the session.
public get_server_data ( ) : array
return array Server variables

get_session() public method

Retrieve the configured session class instance
public get_session ( phpbb\db\driver\driver_interface $dbal ) : phpbb_mock_session_testable
$dbal phpbb\db\driver\driver_interface The database connection to use for session data
return phpbb_mock_session_testable A session instance

merge_cache_data() public method

New values overwrite old ones.
public merge_cache_data ( array $cache_data )
$cache_data array The additional cache data

merge_config_data() public method

New values overwrite new ones.
public merge_config_data ( array $config_data )
$config_data array The config data to merge with previous data

merge_server_data() public method

New values overwrite old ones.
public merge_server_data ( array $server_data )
$server_data array The additional server variables

merge_test_data() public method

New values overwrite old ones.
public merge_test_data ( $session_id, $user_id, $user_agent, $ip, integer $time )
$session_id
$user_id
$user_agent
$ip
$time integer

set_cookies() public method

Set the cookies which should be present in the request data.
public set_cookies ( array $cookies )
$cookies array The cookie data, structured like $_COOKIE contents.

Property Details

$cache protected_oe property

protected $cache

$cache_data protected_oe property

protected $cache_data

$config protected_oe property

protected $config

$config_data protected_oe property

protected $config_data

$container protected_oe property

protected $container

$cookies protected_oe property

protected $cookies

$request protected_oe property

protected $request