diff options
author | Phil Sturgeon <email@philsturgeon.co.uk> | 2012-05-16 14:08:24 +0200 |
---|---|---|
committer | Phil Sturgeon <email@philsturgeon.co.uk> | 2012-05-16 14:08:24 +0200 |
commit | 8279420f989a8cda4427c3983ee919c6a1073dd7 (patch) | |
tree | 77921a510be4a02d3408c259a20af14a67c41d04 /tests/mocks/core/input.php | |
parent | f4f9f787082e45c04a8d007450d9151f5a068732 (diff) | |
parent | 14455e57770112bf8cd938980925ded12f3cba9e (diff) |
Merge pull request #1360 from toopay/core-tests
Unit tests for Benchmark, Input and Security classes.
Diffstat (limited to 'tests/mocks/core/input.php')
-rw-r--r-- | tests/mocks/core/input.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/mocks/core/input.php b/tests/mocks/core/input.php new file mode 100644 index 000000000..8a337d2ef --- /dev/null +++ b/tests/mocks/core/input.php @@ -0,0 +1,31 @@ +<?php + +class Mock_Core_Input extends CI_Input { + + /** + * Since we use GLOBAL to fetch Security and Utf8 classes, + * we need to use inversion of control to mock up + * the same process within CI_Input class constructor. + * + * @covers CI_Input::__construct() + */ + public function __construct($security, $utf8) + { + $this->_allow_get_array = (config_item('allow_get_array') === TRUE); + $this->_enable_xss = (config_item('global_xss_filtering') === TRUE); + $this->_enable_csrf = (config_item('csrf_protection') === TRUE); + + // Assign Security and Utf8 classes + $this->security = $security; + $this->uni = $utf8; + + // Sanitize global arrays + $this->_sanitize_globals(); + } + + public function fetch_from_array($array, $index = '', $xss_clean = FALSE) + { + return parent::_fetch_from_array($array, $index, $xss_clean); + } + +}
\ No newline at end of file |