From 838c9a96f645aac24daa31285efa1051535c4219 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 13 Sep 2013 14:05:13 +0300 Subject: Drop the unused parameter from log_message() / CI_Log::write_log() --- tests/mocks/core/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/mocks') diff --git a/tests/mocks/core/common.php b/tests/mocks/core/common.php index 0ccfe1ea4..e5dc29c86 100644 --- a/tests/mocks/core/common.php +++ b/tests/mocks/core/common.php @@ -178,7 +178,7 @@ if ( ! function_exists('is_loaded')) if ( ! function_exists('log_message')) { - function log_message($level, $message, $php_error = FALSE) + function log_message($level, $message) { return TRUE; } -- cgit v1.2.3-24-g4f1b From f964b16f3db95d655420dfae2012ee9fbb98a1a8 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 12 Nov 2013 17:04:55 +0200 Subject: Deprecate CI_Input::is_cli_request() and add common function is_cli() to replace it Calls to this function are often needed before the Input library is available --- tests/mocks/core/common.php | 9 +++++++++ tests/mocks/core/uri.php | 5 ----- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'tests/mocks') diff --git a/tests/mocks/core/common.php b/tests/mocks/core/common.php index e5dc29c86..b073f230d 100644 --- a/tests/mocks/core/common.php +++ b/tests/mocks/core/common.php @@ -190,4 +190,13 @@ if ( ! function_exists('set_status_header')) { 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/uri.php b/tests/mocks/core/uri.php index 94f75df64..11078587b 100644 --- a/tests/mocks/core/uri.php +++ b/tests/mocks/core/uri.php @@ -18,9 +18,4 @@ class Mock_Core_URI extends CI_URI { } - protected function _is_cli_request() - { - return FALSE; - } - } \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 9765472d1388c631ad57f4bd0dd4dd424f79e5e0 Mon Sep 17 00:00:00 2001 From: Fred Emmott Date: Mon, 13 Jan 2014 14:48:22 -0800 Subject: Don't throw in mock autoloader This behavior doesn't appear to be used at all. This fixes HHVM compatibility: HHVM optimizes class_exists() to a dedicated bytecode - as it's not a function call, it doesn't show up in the backtrace. 100% of the tests pass with this change. --- tests/mocks/autoloader.php | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) (limited to 'tests/mocks') diff --git a/tests/mocks/autoloader.php b/tests/mocks/autoloader.php index 3d216da1f..cc0a2e2f7 100644 --- a/tests/mocks/autoloader.php +++ b/tests/mocks/autoloader.php @@ -89,21 +89,7 @@ function autoload($class) if ( ! file_exists($file)) { - $trace = debug_backtrace(); - - if ($trace[2]['function'] === 'class_exists' OR $trace[2]['function'] === 'file_exists') - { - // If the autoload call came from `class_exists` or `file_exists`, - // we skipped and return FALSE - return FALSE; - } - elseif (($autoloader = spl_autoload_functions()) && end($autoloader) !== __FUNCTION__) - { - // If there was other custom autoloader, passed away - return FALSE; - } - - throw new InvalidArgumentException("Unable to load {$class}."); + return FALSE; } include_once($file); -- cgit v1.2.3-24-g4f1b From de14aa5a29b1b122bfd536f979dfda7f2fd9f53d Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 15 Jan 2014 15:51:08 +0200 Subject: CI_URI changes related to the 'permitted_uri_chars' setting - Initialize and cache the value in the class constructor instead of searching for it every time - Removed the preg_quote() call from _filter_uri() to allow more fine-tuning from configuration - Renamed _filter_uri() to filter_uri() - it was public anyway and using it cannot break anything Related: issue #2799 --- tests/mocks/core/uri.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'tests/mocks') diff --git a/tests/mocks/core/uri.php b/tests/mocks/core/uri.php index 11078587b..96ec5afa1 100644 --- a/tests/mocks/core/uri.php +++ b/tests/mocks/core/uri.php @@ -10,12 +10,23 @@ class Mock_Core_URI extends CI_URI { // set predictable config values $test->ci_set_config(array( 'index_page' => 'index.php', - 'base_url' => 'http://example.com/', - 'subclass_prefix' => 'MY_' + '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 -- cgit v1.2.3-24-g4f1b From 291676be2ca85581b48dfdc40889085f1928fabf Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 16 Jan 2014 18:39:52 +0200 Subject: Add a unit test for CI_Utf8::_is_ascii() --- tests/mocks/core/utf8.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tests/mocks') diff --git a/tests/mocks/core/utf8.php b/tests/mocks/core/utf8.php index 068e74ac1..a43138fbc 100644 --- a/tests/mocks/core/utf8.php +++ b/tests/mocks/core/utf8.php @@ -23,4 +23,9 @@ class Mock_Core_Utf8 extends CI_Utf8 { } } + public function is_ascii_test($str) + { + return $this->_is_ascii($str); + } + } \ No newline at end of file -- cgit v1.2.3-24-g4f1b