3
declare(strict_types=1);
6
* This file is part of CodeIgniter 4 framework.
8
* (c) CodeIgniter Foundation <admin@codeigniter.com>
10
* For the full copyright and license information, please view
11
* the LICENSE file that was distributed with this source code.
18
error_reporting(E_ALL);
19
ini_set('display_errors', '1');
20
ini_set('display_startup_errors', '1');
23
* ---------------------------------------------------------------
25
* ---------------------------------------------------------------
28
// Make sure it recognizes that we're testing.
29
$_SERVER['CI_ENVIRONMENT'] = 'testing';
30
define('ENVIRONMENT', 'testing');
32
defined('CI_DEBUG') || define('CI_DEBUG', true);
35
* ---------------------------------------------------------------
36
* SET UP OUR PATH CONSTANTS
37
* ---------------------------------------------------------------
39
* The path constants provide convenient access to the folders
40
* throughout the application. We have to set them up here
41
* so they are available in the config files that are loaded.
44
// Often these constants are pre-defined, but query the current directory structure as a fallback
45
defined('HOMEPATH') || define('HOMEPATH', realpath(rtrim(getcwd(), '\\/ ')) . DIRECTORY_SEPARATOR);
46
$source = is_dir(HOMEPATH . 'app')
48
: (is_dir('vendor/codeigniter4/framework/') ? 'vendor/codeigniter4/framework/' : 'vendor/codeigniter4/codeigniter4/');
49
defined('CONFIGPATH') || define('CONFIGPATH', realpath($source . 'app/Config') . DIRECTORY_SEPARATOR);
50
defined('PUBLICPATH') || define('PUBLICPATH', realpath($source . 'public') . DIRECTORY_SEPARATOR);
53
// LOAD OUR PATHS CONFIG FILE
54
// Load framework paths from their config file
55
require CONFIGPATH . 'Paths.php';
58
// Define necessary framework path constants
59
defined('APPPATH') || define('APPPATH', realpath(rtrim($paths->appDirectory, '\\/ ')) . DIRECTORY_SEPARATOR);
60
defined('ROOTPATH') || define('ROOTPATH', realpath(APPPATH . '../') . DIRECTORY_SEPARATOR);
61
defined('SYSTEMPATH') || define('SYSTEMPATH', realpath(rtrim($paths->systemDirectory, '\\/')) . DIRECTORY_SEPARATOR);
62
defined('WRITEPATH') || define('WRITEPATH', realpath(rtrim($paths->writableDirectory, '\\/ ')) . DIRECTORY_SEPARATOR);
63
defined('TESTPATH') || define('TESTPATH', realpath(HOMEPATH . 'tests/') . DIRECTORY_SEPARATOR);
65
defined('CIPATH') || define('CIPATH', realpath(SYSTEMPATH . '../') . DIRECTORY_SEPARATOR);
66
defined('FCPATH') || define('FCPATH', realpath(PUBLICPATH) . DIRECTORY_SEPARATOR);
68
defined('SUPPORTPATH') || define('SUPPORTPATH', realpath(TESTPATH . '_support/') . DIRECTORY_SEPARATOR);
69
defined('COMPOSER_PATH') || define('COMPOSER_PATH', (string) realpath(HOMEPATH . 'vendor/autoload.php'));
70
defined('VENDORPATH') || define('VENDORPATH', realpath(HOMEPATH . 'vendor') . DIRECTORY_SEPARATOR);
73
*---------------------------------------------------------------
74
* BOOTSTRAP THE APPLICATION
75
*---------------------------------------------------------------
76
* This process sets up the path constants, loads and registers
77
* our autoloader, along with Composer's, loads our constants
78
* and fires up an environment-specific bootstrapping.
81
// LOAD THE FRAMEWORK BOOTSTRAP FILE
82
require $paths->systemDirectory . '/Boot.php';
83
Boot::bootTest($paths);
86
* ---------------------------------------------------------------
88
* ---------------------------------------------------------------
91
Services::routes()->loadRoutes();