From 1d9d22cc7676fac14bfe4a5b67537ccfb4f1849d Mon Sep 17 00:00:00 2001 From: Andy Chase Date: Wed, 26 Jun 2013 12:43:37 -0700 Subject: [PATCH] [ticket/11620] Add testable facade for sessions.php Since many functions in session.php have global variables inside the function, this exposes those functions through a testable facade that uses testable_factory's mock global variables to modify global variables used in the functions. This is using the facade pattern to provide a testable "front" to the functions in sessions.php. PHPBB3-11620 --- tests/session/testable_facade.php | 49 +++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 tests/session/testable_facade.php diff --git a/tests/session/testable_facade.php b/tests/session/testable_facade.php new file mode 100644 index 0000000000..d4c03ec8d5 --- /dev/null +++ b/tests/session/testable_facade.php @@ -0,0 +1,49 @@ +get_session($db); + global $request; + $request->overwrite('PHP_SELF', $php_self, phpbb_request_interface::SERVER); + $request->overwrite('QUERY_STRING', $query_string, phpbb_request_interface::SERVER); + $request->overwrite('REQUEST_URI', $request_uri, phpbb_request_interface::SERVER); + return phpbb_session::extract_current_page($root_path, phpbb_request_interface::SERVER); + } + + // [To be completed] + // public static function extract_current_hostname() {} + // public static function session_begin($update_session_page = true) {} + // public static function session_create($user_id = false, $set_admin = false, $persist_login = false, $viewonline = true) {} + // public static function session_kill($new_session = true) {} + // public static function session_gc() {} + // public static function set_cookie($name, $cookiedata, $cookietime) {} + // public static function check_ban($user_id = false, $user_ips = false, $user_email = false, $return = false) {} + // public static function check_dnsbl($mode, $ip = false) {} + // public static function set_login_key($user_id = false, $key = false, $user_ip = false) {} + // public static function reset_login_keys($user_id = false) {} + // public static function validate_referer($check_script_path = false) {} + // public static function update_session($session_data, $session_id = null) {} + // public static function unset_admin() {} +} +