blob: b4e56bdae8edebae14d3a1ba23912f0bb3f736c2 [file] [log] [blame]
Pascal Kriete69c97a72011-04-20 21:44:54 -04001<?php
Pascal Krietef5aee9d2011-04-21 01:20:40 -04002// Errors on full!
Pascal Kriete69c97a72011-04-20 21:44:54 -04003ini_set('display_errors', 1);
4error_reporting(E_ALL | E_STRICT);
5
Pascal Krietef5aee9d2011-04-21 01:20:40 -04006$dir = realpath(dirname(__FILE__));
Pascal Kriete69c97a72011-04-20 21:44:54 -04007
Pascal Krietef5aee9d2011-04-21 01:20:40 -04008// Path constants
Taufan Aditya4912f8b2012-05-26 22:09:58 +07009defined('PROJECT_BASE') OR define('PROJECT_BASE', realpath($dir.'/../').'/');
dchill427ecc5cd2012-10-12 16:25:51 -040010defined('SYSTEM_PATH') OR define('SYSTEM_PATH', PROJECT_BASE.'system/');
Pascal Kriete69c97a72011-04-20 21:44:54 -040011
Taufan Adityae13511a2012-05-25 02:15:42 +070012// Get vfsStream either via PEAR or composer
Taufan Adityaeeca6d22012-05-25 03:15:19 +070013foreach (explode(PATH_SEPARATOR, get_include_path()) as $path)
Taufan Aditya6bca9f82012-05-25 01:55:36 +070014{
Taufan Aditya2d574452012-05-25 04:03:56 +070015 if (file_exists($path.DIRECTORY_SEPARATOR.'vfsStream/vfsStream.php'))
Taufan Adityaeeca6d22012-05-25 03:15:19 +070016 {
17 require_once 'vfsStream/vfsStream.php';
18 break;
19 }
Taufan Aditya6bca9f82012-05-25 01:55:36 +070020}
Taufan Adityaeeca6d22012-05-25 03:15:19 +070021
22if ( ! class_exists('vfsStream') && file_exists(PROJECT_BASE.'vendor/autoload.php'))
Taufan Aditya6bca9f82012-05-25 01:55:36 +070023{
Taufan Adityae13511a2012-05-25 02:15:42 +070024 include_once PROJECT_BASE.'vendor/autoload.php';
25 class_alias('org\bovigo\vfs\vfsStream', 'vfsStream');
26 class_alias('org\bovigo\vfs\vfsStreamDirectory', 'vfsStreamDirectory');
27 class_alias('org\bovigo\vfs\vfsStreamWrapper', 'vfsStreamWrapper');
Taufan Aditya6bca9f82012-05-25 01:55:36 +070028}
29
dchill427ecc5cd2012-10-12 16:25:51 -040030// Define CI path constants to VFS (filesystem setup in CI_TestCase::setUp)
31defined('BASEPATH') OR define('BASEPATH', vfsStream::url('system/'));
32defined('APPPATH') OR define('APPPATH', vfsStream::url('application/'));
33defined('VIEWPATH') OR define('VIEWPATH', APPPATH.'views/');
Andrey Andreev76384792013-01-28 11:22:05 +020034defined('ENVIRONMENT') OR define('ENVIRONMENT', 'development');
dchill427ecc5cd2012-10-12 16:25:51 -040035
36// Set localhost "remote" IP
37isset($_SERVER['REMOTE_ADDR']) OR $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
38
Pascal Krietef5aee9d2011-04-21 01:20:40 -040039// Prep our test environment
Taufan Adityaca16c4f2012-03-28 15:15:30 +070040include_once $dir.'/mocks/core/common.php';
dchill42e9435dc2012-10-14 15:44:39 -040041include_once SYSTEM_PATH.'core/Common.php';
Andrey Andreeveb555ed2014-02-12 19:25:01 +020042
Andrey Andreev263e8fe2014-05-09 12:19:15 +030043ini_set('default_charset', 'UTF-8');
Andrey Andreeveb555ed2014-02-12 19:25:01 +020044
45if (extension_loaded('mbstring'))
46{
47 defined('MB_ENABLED') OR define('MB_ENABLED', TRUE);
Andrey Andreev1ffa2232014-05-09 12:30:59 +030048 @ini_set('mbstring.internal_encoding', 'UTF-8');
Andrey Andreeveb555ed2014-02-12 19:25:01 +020049 mb_substitute_character('none');
50}
51else
52{
53 defined('MB_ENABLED') OR define('MB_ENABLED', FALSE);
54}
55
56if (extension_loaded('iconv'))
57{
58 defined('ICONV_ENABLED') OR define('ICONV_ENABLED', TRUE);
Andrey Andreev263e8fe2014-05-09 12:19:15 +030059 @ini_set('iconv.internal_encoding', 'UTF-8');
Andrey Andreeveb555ed2014-02-12 19:25:01 +020060}
61else
62{
63 defined('ICONV_ENABLED') OR define('ICONV_ENABLED', FALSE);
64}
65
Andrey Andreev263e8fe2014-05-09 12:19:15 +030066is_php('5.6') && ini_set('php.internal_encoding', 'UTF-8');
67
Andrey Andreev3fd1b382014-02-13 03:01:31 +020068include_once SYSTEM_PATH.'core/compat/mbstring.php';
Andrey Andreev9a152a92014-02-18 16:29:53 +020069include_once SYSTEM_PATH.'core/compat/hash.php';
Andrey Andreev3fd1b382014-02-13 03:01:31 +020070include_once SYSTEM_PATH.'core/compat/password.php';
Andrey Andreev5b3fe7c2014-07-07 10:55:53 +030071include_once SYSTEM_PATH.'core/compat/standard.php';
Andrey Andreev3fd1b382014-02-13 03:01:31 +020072
Taufan Adityaca16c4f2012-03-28 15:15:30 +070073include_once $dir.'/mocks/autoloader.php';
74spl_autoload_register('autoload');
Pascal Krietef5aee9d2011-04-21 01:20:40 -040075
76unset($dir);