diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php index 9cd5adcb11..a26666e863 100644 --- a/core/lib/Drupal/Core/DrupalKernel.php +++ b/core/lib/Drupal/Core/DrupalKernel.php @@ -1058,12 +1058,14 @@ public static function bootEnvironment($app_root = NULL) { // the internal browser. define('DRUPAL_TEST_IN_CHILD_SITE', TRUE); - // Web tests are to be conducted with runtime assertions active. - // phpcs:ignore Generic.PHP.DeprecatedFunctions.Deprecated - assert_options(ASSERT_ACTIVE, TRUE); - // Force assertion failures to be thrown as exceptions. - // phpcs:ignore Generic.PHP.DeprecatedFunctions.Deprecated - assert_options(ASSERT_EXCEPTION, TRUE); + if (PHP_VERSION_ID < 80300) { + // Web tests are to be conducted with runtime assertions active. + // phpcs:ignore Generic.PHP.DeprecatedFunctions.Deprecated + assert_options(ASSERT_ACTIVE, TRUE); + // Force assertion failures to be thrown as exceptions. + // phpcs:ignore Generic.PHP.DeprecatedFunctions.Deprecated + assert_options(ASSERT_EXCEPTION, TRUE); + } // Log fatal errors to the test site directory. ini_set('log_errors', 1); diff --git a/core/tests/bootstrap.php b/core/tests/bootstrap.php index 6b3dcef294..18b35cf3c7 100644 --- a/core/tests/bootstrap.php +++ b/core/tests/bootstrap.php @@ -176,8 +176,10 @@ class_alias('\Drupal\Tests\DocumentElement', '\Behat\Mink\Element\DocumentElemen // Runtime assertions. PHPUnit follows the php.ini assert.active setting for // runtime assertions. By default this setting is on. Ensure exceptions are // thrown if an assert fails. -// phpcs:ignore Generic.PHP.DeprecatedFunctions.Deprecated -assert_options(ASSERT_EXCEPTION, TRUE); +if (PHP_VERSION_ID < 80300) { + // phpcs:ignore Generic.PHP.DeprecatedFunctions.Deprecated + assert_options(ASSERT_EXCEPTION, TRUE); +} // Ensure ignored deprecation patterns listed in .deprecation-ignore.txt are // considered in testing. diff --git a/sites/example.settings.local.php b/sites/example.settings.local.php index 82ad823525..1e18af9f21 100644 --- a/sites/example.settings.local.php +++ b/sites/example.settings.local.php @@ -32,9 +32,11 @@ * * @see https://wiki.php.net/rfc/expectations */ -// phpcs:ignore Generic.PHP.DeprecatedFunctions.Deprecated -assert_options(ASSERT_ACTIVE, TRUE); -assert_options(ASSERT_EXCEPTION, TRUE); +if (PHP_VERSION_ID < 80300) { + // phpcs:ignore Generic.PHP.DeprecatedFunctions.Deprecated + assert_options(ASSERT_ACTIVE, TRUE); + assert_options(ASSERT_EXCEPTION, TRUE); +} /** * Enable local development services.