Pascal Kriete | 69c97a7 | 2011-04-20 21:44:54 -0400 | [diff] [blame] | 1 | <?php |
| 2 | |
Pascal Kriete | f5aee9d | 2011-04-21 01:20:40 -0400 | [diff] [blame] | 3 | // Errors on full! |
Pascal Kriete | 69c97a7 | 2011-04-20 21:44:54 -0400 | [diff] [blame] | 4 | ini_set('display_errors', 1); |
| 5 | error_reporting(E_ALL | E_STRICT); |
| 6 | |
Pascal Kriete | f5aee9d | 2011-04-21 01:20:40 -0400 | [diff] [blame] | 7 | $dir = realpath(dirname(__FILE__)); |
Pascal Kriete | 69c97a7 | 2011-04-20 21:44:54 -0400 | [diff] [blame] | 8 | |
Pascal Kriete | f5aee9d | 2011-04-21 01:20:40 -0400 | [diff] [blame] | 9 | // Path constants |
Taufan Aditya | 4912f8b | 2012-05-26 22:09:58 +0700 | [diff] [blame] | 10 | defined('PROJECT_BASE') OR define('PROJECT_BASE', realpath($dir.'/../').'/'); |
dchill42 | 7ecc5cd | 2012-10-12 16:25:51 -0400 | [diff] [blame^] | 11 | defined('SYSTEM_PATH') OR define('SYSTEM_PATH', PROJECT_BASE.'system/'); |
Pascal Kriete | 69c97a7 | 2011-04-20 21:44:54 -0400 | [diff] [blame] | 12 | |
Taufan Aditya | e13511a | 2012-05-25 02:15:42 +0700 | [diff] [blame] | 13 | // Get vfsStream either via PEAR or composer |
Taufan Aditya | eeca6d2 | 2012-05-25 03:15:19 +0700 | [diff] [blame] | 14 | foreach (explode(PATH_SEPARATOR, get_include_path()) as $path) |
Taufan Aditya | 6bca9f8 | 2012-05-25 01:55:36 +0700 | [diff] [blame] | 15 | { |
Taufan Aditya | 2d57445 | 2012-05-25 04:03:56 +0700 | [diff] [blame] | 16 | if (file_exists($path.DIRECTORY_SEPARATOR.'vfsStream/vfsStream.php')) |
Taufan Aditya | eeca6d2 | 2012-05-25 03:15:19 +0700 | [diff] [blame] | 17 | { |
| 18 | require_once 'vfsStream/vfsStream.php'; |
| 19 | break; |
| 20 | } |
Taufan Aditya | 6bca9f8 | 2012-05-25 01:55:36 +0700 | [diff] [blame] | 21 | } |
Taufan Aditya | eeca6d2 | 2012-05-25 03:15:19 +0700 | [diff] [blame] | 22 | |
| 23 | if ( ! class_exists('vfsStream') && file_exists(PROJECT_BASE.'vendor/autoload.php')) |
Taufan Aditya | 6bca9f8 | 2012-05-25 01:55:36 +0700 | [diff] [blame] | 24 | { |
Taufan Aditya | e13511a | 2012-05-25 02:15:42 +0700 | [diff] [blame] | 25 | 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 Aditya | 6bca9f8 | 2012-05-25 01:55:36 +0700 | [diff] [blame] | 29 | } |
| 30 | |
dchill42 | 7ecc5cd | 2012-10-12 16:25:51 -0400 | [diff] [blame^] | 31 | // Define CI path constants to VFS (filesystem setup in CI_TestCase::setUp) |
| 32 | defined('BASEPATH') OR define('BASEPATH', vfsStream::url('system/')); |
| 33 | defined('APPPATH') OR define('APPPATH', vfsStream::url('application/')); |
| 34 | defined('VIEWPATH') OR define('VIEWPATH', APPPATH.'views/'); |
| 35 | |
| 36 | // Set localhost "remote" IP |
| 37 | isset($_SERVER['REMOTE_ADDR']) OR $_SERVER['REMOTE_ADDR'] = '127.0.0.1'; |
| 38 | |
Pascal Kriete | f5aee9d | 2011-04-21 01:20:40 -0400 | [diff] [blame] | 39 | // Prep our test environment |
Taufan Aditya | ca16c4f | 2012-03-28 15:15:30 +0700 | [diff] [blame] | 40 | include_once $dir.'/mocks/core/common.php'; |
dchill42 | 7ecc5cd | 2012-10-12 16:25:51 -0400 | [diff] [blame^] | 41 | include_once SYSTEM_PATH.'core/common.php'; |
Taufan Aditya | ca16c4f | 2012-03-28 15:15:30 +0700 | [diff] [blame] | 42 | include_once $dir.'/mocks/autoloader.php'; |
| 43 | spl_autoload_register('autoload'); |
Pascal Kriete | f5aee9d | 2011-04-21 01:20:40 -0400 | [diff] [blame] | 44 | |
| 45 | unset($dir); |