summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Bootstrap.php23
-rw-r--r--tests/mocks/core/utf8.php25
2 files changed, 25 insertions, 23 deletions
diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php
index c98d88531..7f10ea1d6 100644
--- a/tests/Bootstrap.php
+++ b/tests/Bootstrap.php
@@ -40,6 +40,29 @@ isset($_SERVER['REMOTE_ADDR']) OR $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
// Prep our test environment
include_once $dir.'/mocks/core/common.php';
include_once SYSTEM_PATH.'core/Common.php';
+
+
+if (extension_loaded('mbstring'))
+{
+ defined('MB_ENABLED') OR define('MB_ENABLED', TRUE);
+ mb_internal_encoding('UTF-8');
+ mb_substitute_character('none');
+}
+else
+{
+ defined('MB_ENABLED') OR define('MB_ENABLED', FALSE);
+}
+
+if (extension_loaded('iconv'))
+{
+ defined('ICONV_ENABLED') OR define('ICONV_ENABLED', TRUE);
+ iconv_set_encoding('internal_encoding', 'UTF-8');
+}
+else
+{
+ defined('ICONV_ENABLED') OR define('ICONV_ENABLED', FALSE);
+}
+
include_once $dir.'/mocks/autoloader.php';
spl_autoload_register('autoload');
diff --git a/tests/mocks/core/utf8.php b/tests/mocks/core/utf8.php
index 9dda43aec..30b78adfe 100644
--- a/tests/mocks/core/utf8.php
+++ b/tests/mocks/core/utf8.php
@@ -3,35 +3,14 @@
class Mock_Core_Utf8 extends CI_Utf8 {
/**
- * We need to define several constants as
- * the same process within CI_Utf8 class constructor.
+ * We need to define UTF8_ENABLED the same way that
+ * CI_Utf8 constructor does.
*
* @covers CI_Utf8::__construct()
*/
public function __construct()
{
defined('UTF8_ENABLED') OR define('UTF8_ENABLED', TRUE);
-
- if (extension_loaded('mbstring'))
- {
- defined('MB_ENABLED') OR define('MB_ENABLED', TRUE);
- mb_internal_encoding('UTF-8');
- ini_set('mbstring.substitute_character', 'none');
- }
- else
- {
- defined('MB_ENABLED') OR define('MB_ENABLED', FALSE);
- }
-
- if (extension_loaded('iconv'))
- {
- defined('ICONV_ENABLED') OR define('ICONV_ENABLED', TRUE);
- iconv_set_encoding('internal_encoding', 'UTF-8');
- }
- else
- {
- defined('ICONV_ENABLED') OR define('ICONV_ENABLED', FALSE);
- }
}
public function is_ascii_test($str)