summaryrefslogtreecommitdiffstats
path: root/tests/mocks/core
diff options
context:
space:
mode:
authorTimothy Warren <tim@timshomepage.net>2012-06-12 13:45:45 +0200
committerTimothy Warren <tim@timshomepage.net>2012-06-12 13:45:45 +0200
commitb30a7c0d53c5dae5dab2311f777d67f639a5cee4 (patch)
treed518bc938a5d8458a55277d9adaa7d8fdcc9f1d3 /tests/mocks/core
parent3902e383b41c6c0ef77b65e95d451cb2ea3d85db (diff)
parent4e9538fe19b09c0dc588542cfb7f793348b83bf7 (diff)
Merge upstream
Diffstat (limited to 'tests/mocks/core')
-rw-r--r--tests/mocks/core/common.php34
-rw-r--r--tests/mocks/core/input.php6
-rw-r--r--tests/mocks/core/loader.php7
-rw-r--r--tests/mocks/core/security.php2
-rw-r--r--tests/mocks/core/uri.php9
-rw-r--r--tests/mocks/core/utf8.php11
6 files changed, 34 insertions, 35 deletions
diff --git a/tests/mocks/core/common.php b/tests/mocks/core/common.php
index e1c493aa0..a655ee1db 100644
--- a/tests/mocks/core/common.php
+++ b/tests/mocks/core/common.php
@@ -4,11 +4,11 @@
if ( ! function_exists('get_instance'))
{
- function &get_instance()
+ function &get_instance()
{
$test = CI_TestCase::instance();
- $instance = $test->ci_instance();
- return $instance;
+ $test = $test->ci_instance();
+ return $test;
}
}
@@ -16,10 +16,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;
}
}
@@ -29,12 +29,12 @@ if ( ! function_exists('config_item'))
function config_item($item)
{
$config =& get_config();
-
+
if ( ! isset($config[$item]))
{
return FALSE;
}
-
+
return $config[$item];
}
}
@@ -49,16 +49,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 +74,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 +166,4 @@ if ( ! function_exists('set_status_header'))
{
return TRUE;
}
-}
-
-// EOF \ No newline at end of file
+} \ No newline at end of file
diff --git a/tests/mocks/core/input.php b/tests/mocks/core/input.php
index 8a337d2ef..2a4aa4997 100644
--- a/tests/mocks/core/input.php
+++ b/tests/mocks/core/input.php
@@ -1,10 +1,10 @@
<?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
+ * 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()
diff --git a/tests/mocks/core/loader.php b/tests/mocks/core/loader.php
index d4b29bb3d..53d88d55b 100644
--- a/tests/mocks/core/loader.php
+++ b/tests/mocks/core/loader.php
@@ -1,7 +1,7 @@
<?php
class Mock_Core_Loader extends CI_Loader {
-
+
/**
* Since we use paths to load up models, views, etc, we need the ability to
* mock up the file system so when core tests are run, we aren't mucking
@@ -15,16 +15,17 @@ class Mock_Core_Loader extends CI_Loader {
{
vfsStreamWrapper::register();
vfsStreamWrapper::setRoot(new vfsStreamDirectory('application'));
-
+
$this->models_dir = vfsStream::newDirectory('models')->at(vfsStreamWrapper::getRoot());
$this->libs_dir = vfsStream::newDirectory('libraries')->at(vfsStreamWrapper::getRoot());
$this->helpers_dir = vfsStream::newDirectory('helpers')->at(vfsStreamWrapper::getRoot());
$this->views_dir = vfsStream::newDirectory('views')->at(vfsStreamWrapper::getRoot());
-
+
$this->_ci_ob_level = ob_get_level();
$this->_ci_library_paths = array(vfsStream::url('application').'/', BASEPATH);
$this->_ci_helper_paths = array(vfsStream::url('application').'/', BASEPATH);
$this->_ci_model_paths = array(vfsStream::url('application').'/');
$this->_ci_view_paths = array(vfsStream::url('application').'/views/' => TRUE);
}
+
} \ No newline at end of file
diff --git a/tests/mocks/core/security.php b/tests/mocks/core/security.php
index d7ea0e6bd..e19a8b20b 100644
--- a/tests/mocks/core/security.php
+++ b/tests/mocks/core/security.php
@@ -1,7 +1,7 @@
<?php
class Mock_Core_Security extends CI_Security {
-
+
public function csrf_set_cookie()
{
// We cannot set cookie in CLI mode, so for csrf test, who rely on $_COOKIE,
diff --git a/tests/mocks/core/uri.php b/tests/mocks/core/uri.php
index b6946091e..94f75df64 100644
--- a/tests/mocks/core/uri.php
+++ b/tests/mocks/core/uri.php
@@ -1,12 +1,12 @@
<?php
class Mock_Core_URI extends CI_URI {
-
+
public function __construct()
{
$test = CI_TestCase::instance();
$cls =& $test->ci_core_class('cfg');
-
+
// set predictable config values
$test->ci_set_config(array(
'index_page' => 'index.php',
@@ -14,12 +14,13 @@ class Mock_Core_URI extends CI_URI {
'subclass_prefix' => 'MY_'
));
- $this->config = new $cls;
+ $this->config = new $cls;
}
-
+
protected function _is_cli_request()
{
return FALSE;
}
+
} \ No newline at end of file
diff --git a/tests/mocks/core/utf8.php b/tests/mocks/core/utf8.php
index b77d717e7..068e74ac1 100644
--- a/tests/mocks/core/utf8.php
+++ b/tests/mocks/core/utf8.php
@@ -1,27 +1,26 @@
<?php
class Mock_Core_Utf8 extends CI_Utf8 {
-
+
/**
- * We need to define several constants as
+ * We need to define several constants as
* the same process within CI_Utf8 class constructor.
*
* @covers CI_Utf8::__construct()
*/
public function __construct()
{
- defined('UTF8_ENABLED') or define('UTF8_ENABLED', TRUE);
+ defined('UTF8_ENABLED') OR define('UTF8_ENABLED', TRUE);
if (extension_loaded('mbstring'))
{
- defined('MB_ENABLED') or define('MB_ENABLED', TRUE);
+ defined('MB_ENABLED') OR define('MB_ENABLED', TRUE);
mb_internal_encoding('UTF-8');
}
else
{
- defined('MB_ENABLED') or define('MB_ENABLED', FALSE);
+ defined('MB_ENABLED') OR define('MB_ENABLED', FALSE);
}
-
}
} \ No newline at end of file