aboutsummaryrefslogtreecommitdiffstats
path: root/tests/session/testable_factory.php
diff options
context:
space:
mode:
authorAndy Chase <asperous2@gmail.com>2013-06-25 12:24:02 -0700
committerAndy Chase <asperous2@gmail.com>2013-07-22 11:07:43 -0700
commite74abfaa2c25b7c9b4f2f865fbf6800de0761a6b (patch)
tree4f2b083fc21429749c1f706af1d58b6eb2773f6e /tests/session/testable_factory.php
parent362480263cbad6cabbe2637edca153b27d97c493 (diff)
downloadforums-e74abfaa2c25b7c9b4f2f865fbf6800de0761a6b.tar
forums-e74abfaa2c25b7c9b4f2f865fbf6800de0761a6b.tar.gz
forums-e74abfaa2c25b7c9b4f2f865fbf6800de0761a6b.tar.bz2
forums-e74abfaa2c25b7c9b4f2f865fbf6800de0761a6b.tar.xz
forums-e74abfaa2c25b7c9b4f2f865fbf6800de0761a6b.zip
[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
Diffstat (limited to 'tests/session/testable_factory.php')
-rw-r--r--tests/session/testable_factory.php28
1 files changed, 27 insertions, 1 deletions
diff --git a/tests/session/testable_factory.php b/tests/session/testable_factory.php
index ace968eb43..8733ce15ef 100644
--- a/tests/session/testable_factory.php
+++ b/tests/session/testable_factory.php
@@ -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
*
*/
@@ -175,6 +175,32 @@ class phpbb_session_testable_factory
}
/**
+ * 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.
*
* @return array Server variables