blob: 713c0fdb37d0bc622f7f3fcc2fceab24791c7155 [file] [log] [blame]
Pascal Kriete69c97a72011-04-20 21:44:54 -04001<?php
2
Pascal Krietef5aee9d2011-04-21 01:20:40 -04003// Errors on full!
Pascal Kriete69c97a72011-04-20 21:44:54 -04004ini_set('display_errors', 1);
5error_reporting(E_ALL | E_STRICT);
6
Pascal Krietef5aee9d2011-04-21 01:20:40 -04007$dir = realpath(dirname(__FILE__));
Pascal Kriete69c97a72011-04-20 21:44:54 -04008
Pascal Krietef5aee9d2011-04-21 01:20:40 -04009// Path constants
Taufan Aditya4912f8b2012-05-26 22:09:58 +070010defined('PROJECT_BASE') OR define('PROJECT_BASE', realpath($dir.'/../').'/');
dchill427ecc5cd2012-10-12 16:25:51 -040011defined('SYSTEM_PATH') OR define('SYSTEM_PATH', PROJECT_BASE.'system/');
Pascal Kriete69c97a72011-04-20 21:44:54 -040012
Taufan Adityae13511a2012-05-25 02:15:42 +070013// Get vfsStream either via PEAR or composer
Taufan Adityaeeca6d22012-05-25 03:15:19 +070014foreach (explode(PATH_SEPARATOR, get_include_path()) as $path)
Taufan Aditya6bca9f82012-05-25 01:55:36 +070015{
Taufan Aditya2d574452012-05-25 04:03:56 +070016 if (file_exists($path.DIRECTORY_SEPARATOR.'vfsStream/vfsStream.php'))
Taufan Adityaeeca6d22012-05-25 03:15:19 +070017 {
18 require_once 'vfsStream/vfsStream.php';
19 break;
20 }
Taufan Aditya6bca9f82012-05-25 01:55:36 +070021}
Taufan Adityaeeca6d22012-05-25 03:15:19 +070022
23if ( ! class_exists('vfsStream') && file_exists(PROJECT_BASE.'vendor/autoload.php'))
Taufan Aditya6bca9f82012-05-25 01:55:36 +070024{
Taufan Adityae13511a2012-05-25 02:15:42 +070025 include_once PROJECT_BASE.'vendor/autoload.php';
26 class_alias('org\bovigo\vfs\vfsStream', 'vfsStream');
27 class_alias('org\bovigo\vfs\vfsStreamDirectory', 'vfsStreamDirectory');
28 class_alias('org\bovigo\vfs\vfsStreamWrapper', 'vfsStreamWrapper');
Taufan Aditya6bca9f82012-05-25 01:55:36 +070029}
30
dchill427ecc5cd2012-10-12 16:25:51 -040031// Define CI path constants to VFS (filesystem setup in CI_TestCase::setUp)
32defined('BASEPATH') OR define('BASEPATH', vfsStream::url('system/'));
33defined('APPPATH') OR define('APPPATH', vfsStream::url('application/'));
34defined('VIEWPATH') OR define('VIEWPATH', APPPATH.'views/');
Andrey Andreev76384792013-01-28 11:22:05 +020035defined('ENVIRONMENT') OR define('ENVIRONMENT', 'development');
dchill427ecc5cd2012-10-12 16:25:51 -040036
37// Set localhost "remote" IP
38isset($_SERVER['REMOTE_ADDR']) OR $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
39
Pascal Krietef5aee9d2011-04-21 01:20:40 -040040// Prep our test environment
Taufan Adityaca16c4f2012-03-28 15:15:30 +070041include_once $dir.'/mocks/core/common.php';
dchill42e9435dc2012-10-14 15:44:39 -040042include_once SYSTEM_PATH.'core/Common.php';
Andrey Andreeveb555ed2014-02-12 19:25:01 +020043
Andrey Andreev263e8fe2014-05-09 12:19:15 +030044ini_set('default_charset', 'UTF-8');
Andrey Andreeveb555ed2014-02-12 19:25:01 +020045
46if (extension_loaded('mbstring'))
47{
48 defined('MB_ENABLED') OR define('MB_ENABLED', TRUE);
Andrey Andreev1ffa2232014-05-09 12:30:59 +030049 @ini_set('mbstring.internal_encoding', 'UTF-8');
Andrey Andreeveb555ed2014-02-12 19:25:01 +020050 mb_substitute_character('none');
51}
52else
53{
54 defined('MB_ENABLED') OR define('MB_ENABLED', FALSE);
55}
56
57if (extension_loaded('iconv'))
58{
59 defined('ICONV_ENABLED') OR define('ICONV_ENABLED', TRUE);
Andrey Andreev263e8fe2014-05-09 12:19:15 +030060 @ini_set('iconv.internal_encoding', 'UTF-8');
Andrey Andreeveb555ed2014-02-12 19:25:01 +020061}
62else
63{
64 defined('ICONV_ENABLED') OR define('ICONV_ENABLED', FALSE);
65}
66
Andrey Andreev263e8fe2014-05-09 12:19:15 +030067is_php('5.6') && ini_set('php.internal_encoding', 'UTF-8');
68
Andrey Andreev3fd1b382014-02-13 03:01:31 +020069include_once SYSTEM_PATH.'core/compat/mbstring.php';
Andrey Andreev9a152a92014-02-18 16:29:53 +020070include_once SYSTEM_PATH.'core/compat/hash.php';
Andrey Andreev3fd1b382014-02-13 03:01:31 +020071include_once SYSTEM_PATH.'core/compat/password.php';
Andrey Andreev5b3fe7c2014-07-07 10:55:53 +030072include_once SYSTEM_PATH.'core/compat/standard.php';
Andrey Andreev3fd1b382014-02-13 03:01:31 +020073
Taufan Adityaca16c4f2012-03-28 15:15:30 +070074include_once $dir.'/mocks/autoloader.php';
75spl_autoload_register('autoload');
Pascal Krietef5aee9d2011-04-21 01:20:40 -040076
77unset($dir);