The core/bootstrap.inc file is now included by Composer rather than by Drupal code. This file used to be included by DrupalKernel::bootEnvironment() and various scripts like core/includes/install.core.inc but this is no longer necessary. Any script that needs to bootstrap Drupal now only needs to include the autoloader.
This change means that functions and constants that are present in core/bootstrap.inc are now always available in unit tests. This includes t(), drupal_get_filename() and drupal_valid_test_ua().
If your project has unit tests that mock these functions in unit tests by defining the function in the test class these can be removed. If you did not surround these mock functions with a function_exists() check then your unit test will break due to this change. The solution is to use a function_exists() check. This means you can be compatible with both Drupal 9.0.0 and Drupal 9.1.0 and also allow phpunit to run your test alongside other unit tests.
For example if you have a test defining a t() function:
Before
namespace Drupal\Core\Render\Element;
function t($string, array $args = []) {
return strtr($string, $args);
}
After
Wrap in a function_exists() check.
namespace Drupal\Core\Render\Element;
if (!function_exists('t')) {
function t($string, array $args = []) {
return strtr($string, $args);
}
}
Once Drupal 9.1.x is the minimum version your code supports you can completely remove this code.
Comments
APCu autoloader should be disabled
Composer autoloader should be used by default