mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 22:10:45 +02:00
[ticket/11615] Refactored isvalid test to be more imperative
Refactoring the continue/is_valid test to remove the confusing data provider work around, while still keeping redundancies down to a minimum. PHPBB3-11615
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) 2011 phpBB Group
|
||||
* @copyright (c) 2013 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
@@ -174,6 +174,32 @@ class phpbb_session_testable_factory
|
||||
return $this->server_data = array_merge($this->server_data, $server_data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set cookies, merge config and server data in one step.
|
||||
*
|
||||
* New values overwrite old ones.
|
||||
*
|
||||
* @param $session_id
|
||||
* @param $user_id
|
||||
* @param $user_agent
|
||||
* @param $ip
|
||||
* @param int $time
|
||||
*/
|
||||
public function merge_test_data($session_id, $user_id, $user_agent, $ip, $time = 0)
|
||||
{
|
||||
$this->set_cookies(array(
|
||||
'_sid' => $session_id,
|
||||
'_u' => $user_id,
|
||||
));
|
||||
$this->merge_config_data(array(
|
||||
'session_length' => time() + $time, // need to do this to allow sessions started at time 0
|
||||
));
|
||||
$this->merge_server_data(array(
|
||||
'HTTP_USER_AGENT' => $user_agent,
|
||||
'REMOTE_ADDR' => $ip,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all server variables to be passed to the session.
|
||||
*
|
||||
|
Reference in New Issue
Block a user