diff --git a/phpstan-bootstrap.php b/phpstan-bootstrap.php index 99acf96227fe..ce8e4636bd11 100644 --- a/phpstan-bootstrap.php +++ b/phpstan-bootstrap.php @@ -1,6 +1,6 @@ withBootstrapFiles([ - __DIR__ . '/system/Test/bootstrap.php', + __DIR__ . '/system/util_bootstrap.php', ]) ->withPHPStanConfigs([ __DIR__ . '/phpstan.neon.dist', diff --git a/system/util_bootstrap.php b/system/util_bootstrap.php index 3152cc8d1839..5423954deb59 100644 --- a/system/util_bootstrap.php +++ b/system/util_bootstrap.php @@ -61,6 +61,10 @@ defined('CIPATH') || define('CIPATH', realpath($paths->systemDirectory . '/../') . DIRECTORY_SEPARATOR); defined('FCPATH') || define('FCPATH', PUBLICPATH); +if (is_dir($paths->testsDirectory . '/_support/') && ! defined('SUPPORTPATH')) { + define('SUPPORTPATH', realpath($paths->testsDirectory . '/_support/') . DIRECTORY_SEPARATOR); +} + if (is_dir(HOMEPATH . 'vendor/')) { define('VENDORPATH', realpath(HOMEPATH . 'vendor/') . DIRECTORY_SEPARATOR); define('COMPOSER_PATH', (string) realpath(HOMEPATH . 'vendor/autoload.php')); diff --git a/user_guide_src/source/installation/running.rst b/user_guide_src/source/installation/running.rst index 5b39f13f3df9..0fbc6fdc9c11 100644 --- a/user_guide_src/source/installation/running.rst +++ b/user_guide_src/source/installation/running.rst @@ -501,10 +501,15 @@ See :ref:`Deployment `. Bootstrapping the App ********************* -In some scenarios you will want to load the framework without actually running the whole +In some scenarios, you will want to load the framework without actually running the whole application. This is particularly useful for unit testing your project, but may also be handy for using third-party tools to analyze and modify your code. The framework comes -with a separate bootstrap script specifically for this scenario: **system/Test/bootstrap.php**. +with two separate bootstrap scripts specifically for these scenarios: + +- **system/Test/bootstrap.php**: This script is used primarily for unit testing. +- **system/util_bootstrap.php**: This script is used for other scripts that need access to the + framework. It is recommended for use in scripts that are not part for testing as this will NOT + fail gracefully if an exception is thrown. Most of the paths to your project are defined during the bootstrap process. You may use pre-defined constants to override these, but when using the defaults be sure that your diff --git a/utils/check_tabs_in_rst.php b/utils/check_tabs_in_rst.php index e99d08bf7645..69e8f92de1ee 100644 --- a/utils/check_tabs_in_rst.php +++ b/utils/check_tabs_in_rst.php @@ -13,7 +13,7 @@ namespace Utils; -require __DIR__ . '/../system/Test/bootstrap.php'; +require __DIR__ . '/../system/util_bootstrap.php'; use CodeIgniter\CLI\CLI;