blob: ea8d8aea8dd2c21d77ab28582f64a0f4dad4f71c [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/');
35
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';
dchill427ecc5cd2012-10-12 16:25:51 -040041include_once SYSTEM_PATH.'core/common.php';
Taufan Adityaca16c4f2012-03-28 15:15:30 +070042include_once $dir.'/mocks/autoloader.php';
43spl_autoload_register('autoload');
Pascal Krietef5aee9d2011-04-21 01:20:40 -040044
45unset($dir);