mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-07 01:06:48 +02:00
[ticket/16549] Fix tests
PHPBB3-16549
This commit is contained in:
@@ -43,6 +43,16 @@ class phpbb_session_check_ban_test extends phpbb_session_test_case
|
||||
parent::setUp();
|
||||
// Get session here so that config is mocked correctly
|
||||
$this->session = $this->session_factory->get_session($this->db);
|
||||
$this->session->data['user_id'] = ANONYMOUS; // Don't get into the session_kill() procedure
|
||||
$this->session->lang = [
|
||||
'BOARD_BAN_TIME' => 'BOARD_BAN_TIME',
|
||||
'BOARD_BAN_PERM' => 'BOARD_BAN_PERM',
|
||||
'BOARD_BAN_REASON' => 'BOARD_BAN_REASON',
|
||||
'BAN_TRIGGERED_BY_EMAIL' => 'BAN_TRIGGERED_BY_EMAIL',
|
||||
'BAN_TRIGGERED_BY_IP' => 'BAN_TRIGGERED_BY_IP',
|
||||
'BAN_TRIGGERED_BY_USER' => 'BAN_TRIGGERED_BY_USER',
|
||||
];
|
||||
|
||||
global $cache, $config, $phpbb_root_path, $phpEx, $phpbb_filesystem;
|
||||
|
||||
$phpbb_filesystem = new \phpbb\filesystem\filesystem();
|
||||
|
@@ -34,6 +34,8 @@ class phpbb_session_login_keys_test extends phpbb_session_test_case
|
||||
$session->cookie_data['k'] = $this->key_id;
|
||||
|
||||
// Try to access session with the session key
|
||||
global $request, $symfony_request, $phpbb_filesystem, $phpbb_root_path;
|
||||
$session->page = $session->extract_current_page($phpbb_root_path);
|
||||
$session->session_create(false, false, false);
|
||||
$this->assertEquals($this->user_id, $session->data['user_id'], 'User should be logged in by the session key');
|
||||
}
|
||||
@@ -45,6 +47,8 @@ class phpbb_session_login_keys_test extends phpbb_session_test_case
|
||||
$session = $this->session_factory->get_session($this->db);
|
||||
|
||||
// Reset of the keys for this user
|
||||
$session->cookie_data['k'] = $this->key_id;
|
||||
$session->data['user_id'] = $this->user_id;
|
||||
$session->reset_login_keys($this->user_id);
|
||||
|
||||
// Using a user_id and key that was in the database (before reset)
|
||||
@@ -52,6 +56,8 @@ class phpbb_session_login_keys_test extends phpbb_session_test_case
|
||||
$session->cookie_data['k'] = $this->key_id;
|
||||
|
||||
// Try to access session with the session key
|
||||
global $request, $symfony_request, $phpbb_filesystem, $phpbb_root_path;
|
||||
$session->page = $session->extract_current_page($phpbb_root_path);
|
||||
$session->session_create(false, false, $this->user_id);
|
||||
$this->assertNotEquals($this->user_id, $session->data['user_id'], 'User is not logged in because the session key is invalid');
|
||||
|
||||
|
@@ -94,10 +94,12 @@ class phpbb_session_testable_facade
|
||||
$this->session_factory->merge_config_data($config_overrides);
|
||||
// Bots
|
||||
$this->session_factory->merge_cache_data(array('_bots' => $bot_overrides));
|
||||
global $request;
|
||||
global $request, $symfony_request, $phpbb_filesystem, $phpbb_root_path;
|
||||
$session = $this->session_factory->get_session($this->db);
|
||||
$session->browser = $user_agent;
|
||||
$session->ip = $ip_address;
|
||||
$session->page = $session->extract_current_page($phpbb_root_path);
|
||||
|
||||
// Uri sid
|
||||
if ($uri_sid)
|
||||
{
|
||||
|
Reference in New Issue
Block a user