summaryrefslogtreecommitdiffstats
path: root/tests/mocks/core/common.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-06-09 22:34:21 +0200
committerAndrey Andreev <narf@bofh.bg>2012-06-09 22:34:21 +0200
commitf243ce13b4baf5bf8bebf36586514bb243dfc355 (patch)
tree6f9b26f7b1c82f50c0c9e4a1d0190b3398948da7 /tests/mocks/core/common.php
parentc186288755aba46a2b6f0c3f104d9a6ce6b11a7f (diff)
Cleanup/optimize tests/mocks/
Diffstat (limited to 'tests/mocks/core/common.php')
-rw-r--r--tests/mocks/core/common.php36
1 files changed, 16 insertions, 20 deletions
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