From f243ce13b4baf5bf8bebf36586514bb243dfc355 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 9 Jun 2012 23:34:21 +0300 Subject: Cleanup/optimize tests/mocks/ --- tests/mocks/core/common.php | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) (limited to 'tests/mocks/core/common.php') diff --git a/tests/mocks/core/common.php b/tests/mocks/core/common.php index e1c493aa0..8466e47f8 100644 --- a/tests/mocks/core/common.php +++ b/tests/mocks/core/common.php @@ -4,11 +4,10 @@ if ( ! function_exists('get_instance')) { - function &get_instance() + function &get_instance() { $test = CI_TestCase::instance(); - $instance = $test->ci_instance(); - return $instance; + return $test->ci_instance(); } } @@ -16,11 +15,10 @@ if ( ! function_exists('get_instance')) if ( ! function_exists('get_config')) { - function &get_config() { + function &get_config() + { $test = CI_TestCase::instance(); - $config = $test->ci_get_config(); - - return $config; + return $test->ci_get_config(); } } @@ -29,12 +27,12 @@ if ( ! function_exists('config_item')) function config_item($item) { $config =& get_config(); - + if ( ! isset($config[$item])) { return FALSE; } - + return $config[$item]; } } @@ -49,16 +47,16 @@ if ( ! function_exists('load_class')) { 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.''); + throw new Exception('Bad Isolation: Use ci_set_core_class to set '.$class); } - + return $obj; } } @@ -74,16 +72,16 @@ if ( ! function_exists('remove_invisible_characters')) function remove_invisible_characters($str, $url_encoded = TRUE) { $non_displayables = array(); - + // every control character except newline (dec 10) // carriage return (dec 13), and horizontal tab (dec 09) - + if ($url_encoded) { $non_displayables[] = '/%0[0-8bcef]/'; // url encoded 00-08, 11, 12, 14, 15 $non_displayables[] = '/%1[0-9a-f]/'; // url encoded 16-31 } - + $non_displayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127 do @@ -166,6 +164,4 @@ if ( ! function_exists('set_status_header')) { return TRUE; } -} - -// EOF \ No newline at end of file +} \ No newline at end of file -- cgit v1.2.3-24-g4f1b