From b73eb19aed66190c10c9cad476da7c36c271d6dc Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 19 Sep 2019 15:08:45 +0300 Subject: [ci skip] 3.1.11 release --- tests/mocks/core/common.php | 153 ------------------------------------------ tests/mocks/core/input.php | 49 -------------- tests/mocks/core/security.php | 35 ---------- tests/mocks/core/uri.php | 32 --------- tests/mocks/core/utf8.php | 19 ------ 5 files changed, 288 deletions(-) delete mode 100644 tests/mocks/core/common.php delete mode 100644 tests/mocks/core/input.php delete mode 100644 tests/mocks/core/security.php delete mode 100644 tests/mocks/core/uri.php delete mode 100644 tests/mocks/core/utf8.php (limited to 'tests/mocks/core') diff --git a/tests/mocks/core/common.php b/tests/mocks/core/common.php deleted file mode 100644 index 2e8265b15..000000000 --- a/tests/mocks/core/common.php +++ /dev/null @@ -1,153 +0,0 @@ -ci_instance(); - return $test; - } -} - -// -------------------------------------------------------------------- - -if ( ! function_exists('get_config')) -{ - function &get_config() - { - $test = CI_TestCase::instance(); - $config = $test->ci_get_config(); - return $config; - } -} - -if ( ! function_exists('config_item')) -{ - function config_item($item) - { - $config =& get_config(); - - if ( ! isset($config[$item])) - { - return NULL; - } - - return $config[$item]; - } -} - -if ( ! function_exists('get_mimes')) -{ - /** - * Returns the MIME types array from config/mimes.php - * - * @return array - */ - function &get_mimes() - { - static $_mimes = array(); - - if (empty($_mimes)) - { - $path = realpath(PROJECT_BASE.'application/config/mimes.php'); - if (is_file($path)) - { - $_mimes = include($path); - } - } - - return $_mimes; - } -} - -// -------------------------------------------------------------------- - -/* -if ( ! function_exists('load_class')) -{ - function load_class($class, $directory = 'libraries', $prefix = 'CI_') - { - if ($directory !== 'core' OR $prefix !== 'CI_') - { - throw new Exception('Not Implemented: Non-core load_class()'); - } - - $test = CI_TestCase::instance(); - - $obj =& $test->ci_core_class($class); - - if (is_string($obj)) - { - throw new Exception('Bad Isolation: Use ci_set_core_class to set '.$class); - } - - return $obj; - } -} -*/ - -// Clean up error messages -// -------------------------------------------------------------------- - -if ( ! function_exists('show_error')) -{ - function show_error($message, $status_code = 500, $heading = 'An Error Was Encountered') - { - throw new RuntimeException('CI Error: '.$message); - } -} - -if ( ! function_exists('show_404')) -{ - function show_404($page = '', $log_error = TRUE) - { - throw new RuntimeException('CI Error: 404'); - } -} - -if ( ! function_exists('_exception_handler')) -{ - function _exception_handler($severity, $message, $filepath, $line) - { - throw new RuntimeException('CI Exception: '.$message.' | '.$filepath.' | '.$line); - } -} - -// We assume a few things about our environment ... -// -------------------------------------------------------------------- -if ( ! function_exists('is_loaded')) -{ - function &is_loaded() - { - $loaded = array(); - return $loaded; - } -} - -if ( ! function_exists('log_message')) -{ - function log_message($level, $message) - { - return TRUE; - } -} - -if ( ! function_exists('set_status_header')) -{ - function set_status_header($code = 200, $text = '') - { - return TRUE; - } -} - -if ( ! function_exists('is_cli')) -{ - // In order to test HTTP functionality, we need to lie about this - function is_cli() - { - return FALSE; - } -} \ No newline at end of file diff --git a/tests/mocks/core/input.php b/tests/mocks/core/input.php deleted file mode 100644 index 40e27441f..000000000 --- a/tests/mocks/core/input.php +++ /dev/null @@ -1,49 +0,0 @@ -_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); - } - - /** - * Lie about being a CLI request - * - * We take advantage of this in libraries/Session_test - */ - public function is_cli_request() - { - return FALSE; - } - - public function __set($name, $value) - { - if ($name === 'ip_address') - { - $this->ip_address = $value; - } - } - -} \ No newline at end of file diff --git a/tests/mocks/core/security.php b/tests/mocks/core/security.php deleted file mode 100644 index 6cff85860..000000000 --- a/tests/mocks/core/security.php +++ /dev/null @@ -1,35 +0,0 @@ -{'_'.$property}) ? $this->{'_'.$property} : NULL; - } - - public function remove_evil_attributes($str, $is_image) - { - return $this->_remove_evil_attributes($str, $is_image); - } - - // Override inaccessible protected method - public function __call($method, $params) - { - if (is_callable(array($this, '_'.$method))) - { - return call_user_func_array(array($this, '_'.$method), $params); - } - - throw new BadMethodCallException('Method '.$method.' was not found'); - } - -} diff --git a/tests/mocks/core/uri.php b/tests/mocks/core/uri.php deleted file mode 100644 index 96ec5afa1..000000000 --- a/tests/mocks/core/uri.php +++ /dev/null @@ -1,32 +0,0 @@ -ci_core_class('cfg'); - - // set predictable config values - $test->ci_set_config(array( - 'index_page' => 'index.php', - 'base_url' => 'http://example.com/', - 'subclass_prefix' => 'MY_', - 'enable_query_strings' => FALSE, - 'permitted_uri_chars' => 'a-z 0-9~%.:_\-' - )); - - $this->config = new $cls; - - if ($this->config->item('enable_query_strings') !== TRUE OR is_cli()) - { - $this->_permitted_uri_chars = $this->config->item('permitted_uri_chars'); - } - } - - public function _set_permitted_uri_chars($value) - { - $this->_permitted_uri_chars = $value; - } - -} \ No newline at end of file diff --git a/tests/mocks/core/utf8.php b/tests/mocks/core/utf8.php deleted file mode 100644 index 3a6282e1d..000000000 --- a/tests/mocks/core/utf8.php +++ /dev/null @@ -1,19 +0,0 @@ -