/src/tests/bootstrap/CITestBase.php
https://github.com/dstockto/joind.in · PHP · 216 lines · 53 code · 25 blank · 138 comment · 6 complexity · 8d7e2ecd38abac803af415e2203a4698 MD5 · raw file
- <?php
- ob_start();
- /**
- * CodeIgniter
- *
- * An open source application development framework for PHP 4.3.2 or newer
- *
- * @package CodeIgniter
- * @author ExpressionEngine Dev Team
- * @copyright Copyright (c) 2008 - 2009, EllisLab, Inc.
- * @license http://codeigniter.com/user_guide/license.html
- * @link http://codeigniter.com
- * @since Version 1.0
- * @filesource
- */
-
- /*
- |---------------------------------------------------------------
- | PHP ERROR REPORTING LEVEL
- |---------------------------------------------------------------
- |
- | By default CI runs with error reporting set to ALL. For security
- | reasons you are encouraged to change this when your site goes live.
- | For more info visit: http://www.php.net/error_reporting
- |
- */
- error_reporting(E_ALL | E_STRICT);
- /*
- |---------------------------------------------------------------
- | SYSTEM FOLDER NAME
- |---------------------------------------------------------------
- |
- | This variable must contain the name of your "system" folder.
- | Include the path if the folder is not in the same directory
- | as this file.
- |
- | NO TRAILING SLASH!
- |
- */
- $system_folder = "../../system";
-
- /*
- |---------------------------------------------------------------
- | APPLICATION FOLDER NAME
- |---------------------------------------------------------------
- |
- | If you want this front controller to use a different "application"
- | folder then the default one you can set its name here. The folder
- | can also be renamed or relocated anywhere on your server.
- | For more info please see the user guide:
- | http://codeigniter.com/user_guide/general/managing_apps.html
- |
- |
- | NO TRAILING SLASH!
- |
- */
- $application_folder = "";
-
- /*
- |===============================================================
- | END OF USER CONFIGURABLE SETTINGS
- |===============================================================
- */
-
- /*
- |---------------------------------------------------------------
- | SET THE SERVER PATH
- |---------------------------------------------------------------
- |
- | Let's attempt to determine the full-server path to the "system"
- | folder in order to reduce the possibility of path problems.
- | Note: We only attempt this if the user hasn't specified a
- | full server path.
- |
- */
-
- if (function_exists('realpath') AND @realpath(dirname(__FILE__)) !== FALSE)
- {
- $system_folder = realpath(dirname(__FILE__)).'/'.$system_folder;
- }
-
- /*
- |---------------------------------------------------------------
- | DEFINE APPLICATION CONSTANTS
- |---------------------------------------------------------------
- |
- | EXT - The file extension. Typically ".php"
- | SELF - The name of THIS file (typically "index.php")
- | FCPATH - The full server path to THIS file
- | BASEPATH - The full server path to the "system" folder
- | APPPATH - The full server path to the "application" folder
- |
- */
- define('EXT', '.php');
- define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
- define('FCPATH', str_replace(SELF, '', __FILE__));
- define('BASEPATH', $system_folder.'/');
-
- if (is_dir($application_folder))
- {
- define('APPPATH', $application_folder.'/');
- }
- else
- {
- if ($application_folder == '')
- {
- $application_folder = 'application';
- }
-
- define('APPPATH', BASEPATH.$application_folder.'/');
- }
-
- // CI Version
- define('CI_VERSION', '1.7.2-UNIT_TEST');
-
- /*
- * ------------------------------------------------------
- * Load the global functions
- * ------------------------------------------------------
- */
- require(BASEPATH.'codeigniter/Common'.EXT);
-
- /*
- * ------------------------------------------------------
- * Load the compatibility override functions
- * ------------------------------------------------------
- */
- require(BASEPATH.'codeigniter/Compat'.EXT);
-
- /*
- * ------------------------------------------------------
- * Load the framework constants
- * ------------------------------------------------------
- */
- require(APPPATH.'config/constants'.EXT);
-
- /*
- * ------------------------------------------------------
- * Define a custom error handler so we can log PHP errors
- * ------------------------------------------------------
- */
- set_error_handler('_exception_handler');
-
- if ( ! is_php('5.3'))
- {
- @set_magic_quotes_runtime(0); // Kill magic quotes
- }
-
- /*
- * ------------------------------------------------------
- * Start the timer... tick tock tick tock...
- * ------------------------------------------------------
- */
-
- $BM =& load_class('Benchmark');
- $BM->mark('total_execution_time_start');
- $BM->mark('loading_time_base_classes_start');
-
- /*
- * ------------------------------------------------------
- * Instantiate the hooks class
- * ------------------------------------------------------
- */
-
- $EXT =& load_class('Hooks');
-
- /*
- * ------------------------------------------------------
- * Is there a "pre_system" hook?
- * ------------------------------------------------------
- */
- $EXT->_call_hook('pre_system');
-
- /*
- * ------------------------------------------------------
- * Instantiate the base classes
- * ------------------------------------------------------
- */
-
- $CFG =& load_class('Config');
- $URI =& load_class('URI');
-
- /*
- * ------------------------------------------------------
- * Load the remaining base classes
- * ------------------------------------------------------
- */
-
- $IN =& load_class('Input');
- $LANG =& load_class('Language');
-
- /*
- * ------------------------------------------------------
- * Load the app controller and local controller
- * ------------------------------------------------------
- *
- * Note: Due to the poor object handling in PHP 4 we'll
- * conditionally load different versions of the base
- * class. Retaining PHP 4 compatibility requires a bit of a hack.
- *
- * Note: The Loader class needs to be included first
- *
- */
- if ( ! is_php('5.0.0'))
- {
- load_class('Loader', FALSE);
- require(BASEPATH.'codeigniter/Base4'.EXT);
- }
- else
- {
- require(BASEPATH.'codeigniter/Base5'.EXT);
- }
-
- // Load the base controller class
- //load_class('Controller', FALSE);
- load_class('Controller');