blob: 40e27441f47921697ccd62978e59eaefac5afb20 [file] [log] [blame]
Taufan Aditya7756af52012-05-15 23:57:05 +07001<?php
2
3class Mock_Core_Input extends CI_Input {
Andrey Andreevf243ce12012-06-09 23:34:21 +03004
Taufan Aditya7756af52012-05-15 23:57:05 +07005 /**
Andrey Andreevf243ce12012-06-09 23:34:21 +03006 * Since we use GLOBAL to fetch Security and Utf8 classes,
7 * we need to use inversion of control to mock up
Taufan Aditya7756af52012-05-15 23:57:05 +07008 * the same process within CI_Input class constructor.
9 *
10 * @covers CI_Input::__construct()
11 */
12 public function __construct($security, $utf8)
13 {
14 $this->_allow_get_array = (config_item('allow_get_array') === TRUE);
15 $this->_enable_xss = (config_item('global_xss_filtering') === TRUE);
16 $this->_enable_csrf = (config_item('csrf_protection') === TRUE);
17
18 // Assign Security and Utf8 classes
19 $this->security = $security;
20 $this->uni = $utf8;
21
22 // Sanitize global arrays
23 $this->_sanitize_globals();
24 }
25
26 public function fetch_from_array($array, $index = '', $xss_clean = FALSE)
27 {
28 return parent::_fetch_from_array($array, $index, $xss_clean);
29 }
30
dchill4282003da2012-10-09 13:28:17 -040031 /**
32 * Lie about being a CLI request
33 *
34 * We take advantage of this in libraries/Session_test
35 */
36 public function is_cli_request()
37 {
38 return FALSE;
39 }
40
Andrey Andreev52caf592015-02-27 15:09:34 +020041 public function __set($name, $value)
42 {
43 if ($name === 'ip_address')
44 {
45 $this->ip_address = $value;
46 }
47 }
48
Taufan Aditya7756af52012-05-15 23:57:05 +070049}