diff --git a/index.php b/index.php index ab34dc6830..9906979fe0 100644 --- a/index.php +++ b/index.php @@ -188,6 +188,46 @@ $loader->initialize(new Config\Autoload()); // the psr4 loader. $loader->register(); +/* + * ------------------------------------------------------ + * Load the global functions + * ------------------------------------------------------ + */ + +require_once BASEPATH.'Common.php'; + +/* + * ------------------------------------------------------ + * Set custom exception handling + * ------------------------------------------------------ + */ +$config = new \Config\App(); + +Config\Services::exceptions($config, true) + ->initialize(); + +//-------------------------------------------------------------------- +// Should we use a Composer autoloader? +//-------------------------------------------------------------------- + +if ($composer_autoload = $config->composerAutoload) +{ + if ($composer_autoload === TRUE) + { + file_exists(APPPATH.'vendor/autoload.php') + ? require_once(APPPATH.'vendor/autoload.php') + : log_message('error', '$config->\'composerAutoload\' is set to TRUE but '.APPPATH.'vendor/autoload.php was not found.'); + } + elseif (file_exists($composer_autoload)) + { + require_once($composer_autoload); + } + else + { + log_message('error', 'Could not find the specified $config->\'composerAutoload\' path: '.$composer_autoload); + } +} + /* * -------------------------------------------------------------------- * LOAD THE BOOTSTRAP FILE @@ -195,7 +235,5 @@ $loader->register(); * * And away we go... */ -$config = new Config\App(); -new CodeIgniter\Bootstrap($config); $codeigniter = new CodeIgniter\CodeIgniter($startMemory, $startTime, $config); $codeigniter->run(); diff --git a/phpunit.xml b/phpunit.xml index 032f2c5bbf..9423e325e6 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -18,7 +18,6 @@ ./system - ./system/Bootstrap.php ./system/ComposerScripts.php ./system/View/Escaper.php ./system/View/Exception diff --git a/system/Bootstrap.php b/system/Bootstrap.php deleted file mode 100644 index 26141399a4..0000000000 --- a/system/Bootstrap.php +++ /dev/null @@ -1,117 +0,0 @@ -config = $config; - - require_once BASEPATH.'Common.php'; - - $this->setExceptionHandling(); - $this->loadComposerAutoloader(); - } - - //-------------------------------------------------------------------- - - /** - * Set custom exception handling - */ - protected function setExceptionHandling() - { - Services::exceptions($this->config, true) - ->initialize(); - } - - //-------------------------------------------------------------------- - - /** - * Should we use a Composer autoloader? - * - * CodeIgniter provides its own PSR4-compatible autoloader, but many - * third-party scripts will take advantage of the extra flexibility - * that Composer provides. This allows that support to be provided, - * and even with a customizable path to their autoloader. - */ - protected function loadComposerAutoloader() - { - $composer_autoload = $this->config->composerAutoload; - - if (empty($composer_autoload)) - { - return; - } - - if ($composer_autoload === true) - { - file_exists(APPPATH.'vendor/autoload.php') - ? require_once(APPPATH.'vendor/autoload.php') - : log_message('error', '$this->config->\'composerAutoload\' is set to TRUE but '.APPPATH. - 'vendor/autoload.php was not found.'); - } - elseif (file_exists($composer_autoload)) - { - require_once($composer_autoload); - } - else - { - log_message('error', - 'Could not find the specified $this->config->\'composerAutoload\' path: '.$composer_autoload); - } - } -} diff --git a/tests/_support/MockBootstrap.php b/tests/_support/MockBootstrap.php deleted file mode 100644 index 91de5f1339..0000000000 --- a/tests/_support/MockBootstrap.php +++ /dev/null @@ -1,6 +0,0 @@ -load(); +unset($env); + /* * ------------------------------------------------------ * Load the framework constants @@ -130,12 +118,45 @@ $loader->register(); $loader->addNamespace('CodeIgniter', SUPPORTPATH); $loader->addNamespace('Config', SUPPORTPATH.'Config'); +/* + * ------------------------------------------------------ + * Load the global functions + * ------------------------------------------------------ + */ + +require_once BASEPATH.'Common.php'; + +/* + * ------------------------------------------------------ + * Set custom exception handling + * ------------------------------------------------------ + */ +$config = new \Config\App(); + +Config\Services::exceptions($config, true) + ->initialize(); + //-------------------------------------------------------------------- -// LOAD THE BOOTSTRAP FILE +// Should we use a Composer autoloader? //-------------------------------------------------------------------- -$config = new Config\App(); -new CodeIgniter\MockBootstrap($config); +if ($composer_autoload = $config->composerAutoload) +{ + if ($composer_autoload === TRUE) + { + file_exists(APPPATH.'vendor/autoload.php') + ? require_once(APPPATH.'vendor/autoload.php') + : log_message('error', '$config->\'composerAutoload\' is set to TRUE but '.APPPATH.'vendor/autoload.php was not found.'); + } + elseif (file_exists($composer_autoload)) + { + require_once($composer_autoload); + } + else + { + log_message('error', 'Could not find the specified $config->\'composerAutoload\' path: '.$composer_autoload); + } +} //-------------------------------------------------------------------- // Load our TestCase