blob: 1c666d503bf61f67ed7c429fc858ee67b2a795e5 [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.'/../').'/');
11defined('BASEPATH') OR define('BASEPATH', PROJECT_BASE.'system/');
12defined('APPPATH') OR define('APPPATH', PROJECT_BASE.'application/');
13defined('VIEWPATH') OR define('VIEWPATH', PROJECT_BASE.'');
Andrey Andreev580fe8e2012-10-09 13:27:50 +030014isset($_SERVER['REMOTE_ADDR']) OR $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
Pascal Kriete69c97a72011-04-20 21:44:54 -040015
Taufan Adityae13511a2012-05-25 02:15:42 +070016// Get vfsStream either via PEAR or composer
Taufan Adityaeeca6d22012-05-25 03:15:19 +070017foreach (explode(PATH_SEPARATOR, get_include_path()) as $path)
Taufan Aditya6bca9f82012-05-25 01:55:36 +070018{
Taufan Aditya2d574452012-05-25 04:03:56 +070019 if (file_exists($path.DIRECTORY_SEPARATOR.'vfsStream/vfsStream.php'))
Taufan Adityaeeca6d22012-05-25 03:15:19 +070020 {
21 require_once 'vfsStream/vfsStream.php';
22 break;
23 }
Taufan Aditya6bca9f82012-05-25 01:55:36 +070024}
Taufan Adityaeeca6d22012-05-25 03:15:19 +070025
26if ( ! class_exists('vfsStream') && file_exists(PROJECT_BASE.'vendor/autoload.php'))
Taufan Aditya6bca9f82012-05-25 01:55:36 +070027{
Taufan Adityae13511a2012-05-25 02:15:42 +070028 include_once PROJECT_BASE.'vendor/autoload.php';
29 class_alias('org\bovigo\vfs\vfsStream', 'vfsStream');
30 class_alias('org\bovigo\vfs\vfsStreamDirectory', 'vfsStreamDirectory');
31 class_alias('org\bovigo\vfs\vfsStreamWrapper', 'vfsStreamWrapper');
Taufan Aditya6bca9f82012-05-25 01:55:36 +070032}
33
Pascal Krietef5aee9d2011-04-21 01:20:40 -040034// Prep our test environment
Taufan Adityaca16c4f2012-03-28 15:15:30 +070035include_once $dir.'/mocks/core/common.php';
36include_once $dir.'/mocks/autoloader.php';
37spl_autoload_register('autoload');
Pascal Krietef5aee9d2011-04-21 01:20:40 -040038
39unset($dir);