This repository has been archived by the owner on May 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
bootstrap.php
64 lines (51 loc) · 2.43 KB
/
bootstrap.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
ini_set('error_reporting', E_ALL);
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
// Make sure it recognizes that we're testing.
$_SERVER['CI_ENVIRONMENT'] = 'testing';
define('ENVIRONMENT', 'testing');
// Load our paths config file
require __DIR__ . '/../../vendor/codeigniter4/codeigniter4/app/Config/Paths.php';
$paths = new Config\Paths();
// Define necessary framework path constants
define('APPPATH', realpath($paths->appDirectory) . DIRECTORY_SEPARATOR);
define('ROOTPATH', realpath(APPPATH . '../') . DIRECTORY_SEPARATOR);
define('FCPATH', realpath(ROOTPATH . 'public') . DIRECTORY_SEPARATOR);
define('WRITEPATH', realpath($paths->writableDirectory) . DIRECTORY_SEPARATOR);
define('SYSTEMPATH', realpath($paths->systemDirectory) . DIRECTORY_SEPARATOR);
define('CIPATH', realpath(SYSTEMPATH . '../') . DIRECTORY_SEPARATOR);
define('SUPPORTPATH', realpath(CIPATH . 'tests/_support') . DIRECTORY_SEPARATOR);
// Define necessary module test path constants
define('MODULESUPPORTPATH', realpath(__DIR__) . DIRECTORY_SEPARATOR);
define('TESTPATH', realpath(MODULESUPPORTPATH . '../') . DIRECTORY_SEPARATOR);
define('MODULEPATH', realpath(__DIR__ . '/../../') . DIRECTORY_SEPARATOR);
define('COMPOSER_PATH', MODULEPATH . 'vendor/autoload.php');
// Let's see if an app/Common.php file exists
if (file_exists(APPPATH . 'Common.php'))
{
require_once APPPATH . 'Common.php';
}
// Require system/Common.php
require_once SYSTEMPATH . 'Common.php';
// Set environment values that would otherwise stop the framework from functioning during tests.
if (! isset($_SERVER['app.baseURL']))
{
$_SERVER['app.baseURL'] = 'http://example.com';
}
// Load necessary modules
require_once APPPATH . 'Config/Autoload.php';
require_once APPPATH . 'Config/Constants.php';
require_once APPPATH . 'Config/Modules.php';
require_once SYSTEMPATH . 'Autoloader/Autoloader.php';
require_once SYSTEMPATH . 'Config/BaseService.php';
require_once APPPATH . 'Config/Services.php';
// Use Config\Services as CodeIgniter\Services
if (! class_exists('CodeIgniter\Services', false))
{
class_alias('Config\Services', 'CodeIgniter\Services');
}
// Launch the autoloader to gather namespaces (includes composer.json's "autoload-dev")
$loader = \CodeIgniter\Services::autoloader();
$loader->initialize(new Config\Autoload(), new Config\Modules());
$loader->register(); // Register the loader with the SPL autoloader stack.