blob: 439c7fdab2aee8ed93f20a918dae21da8d30d5cf [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
44
45if (extension_loaded('mbstring'))
46{
47 defined('MB_ENABLED') OR define('MB_ENABLED', TRUE);
48 mb_internal_encoding('UTF-8');
49 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);
59 iconv_set_encoding('internal_encoding', 'UTF-8');
60}
61else
62{
63 defined('ICONV_ENABLED') OR define('ICONV_ENABLED', FALSE);
64}
65
Andrey Andreev3fd1b382014-02-13 03:01:31 +020066include_once SYSTEM_PATH.'core/compat/mbstring.php';
67include_once SYSTEM_PATH.'core/compat/password.php';
68
Taufan Adityaca16c4f2012-03-28 15:15:30 +070069include_once $dir.'/mocks/autoloader.php';
70spl_autoload_register('autoload');
Pascal Krietef5aee9d2011-04-21 01:20:40 -040071
72unset($dir);