diff --git a/core/modules/system/tests/modules/error_test/src/Controller/ErrorTestController.php b/core/modules/system/tests/modules/error_test/src/Controller/ErrorTestController.php index fbbb613324..be5b85a316 100644 --- a/core/modules/system/tests/modules/error_test/src/Controller/ErrorTestController.php +++ b/core/modules/system/tests/modules/error_test/src/Controller/ErrorTestController.php @@ -46,8 +46,6 @@ public function generateWarnings($collect_errors = FALSE) { // This will generate a notice. $bananas = []; $monkey_love = $bananas[1]; - // This will generate a warning. - $awesomely_big = 1 / 0; // This will generate a user error. Use & to check for double escaping. trigger_error("Drupal & awesome", E_USER_WARNING); return []; diff --git a/core/tests/Drupal/Tests/Core/Routing/CompiledRouteLegacyTest.php b/core/tests/Drupal/Tests/Core/Routing/CompiledRouteLegacyTest.php index 51807014c5..9e098b63da 100644 --- a/core/tests/Drupal/Tests/Core/Routing/CompiledRouteLegacyTest.php +++ b/core/tests/Drupal/Tests/Core/Routing/CompiledRouteLegacyTest.php @@ -56,8 +56,14 @@ protected function setUp(): void { * @expectedDeprecation Drupal\Core\Routing\CompiledRoute::getOptions() is deprecated in drupal:9.1.0 and is removed from drupal:10.0.0. No direct replacement is provided. See https://www.drupal.org/node/3159706 */ public function testOptionsDeprecated() { - $this->expectNotice(); - $this->expectNoticeMessage('Undefined property: Drupal\Core\Routing\CompiledRoute::$route'); + if (PHP_VERSION_ID < 80000) { + $this->expectNotice(); + $this->expectNoticeMessage('Undefined property: Drupal\Core\Routing\CompiledRoute::$route'); + } + else { + $this->expectWarning(); + $this->expectWarningMessage('Undefined property: Drupal\Core\Routing\CompiledRoute::$route'); + } $this->compiled_route->getOptions(); } @@ -79,8 +85,14 @@ public function testOptionsDynamicallySet() { * @expectedDeprecation Drupal\Core\Routing\CompiledRoute::getDefaults() is deprecated in drupal:9.1.0 and is removed from drupal:10.0.0. No direct replacement is provided. See https://www.drupal.org/node/3159706 */ public function testDefaultsDeprecated() { - $this->expectNotice(); - $this->expectNoticeMessage('Undefined property: Drupal\Core\Routing\CompiledRoute::$route'); + if (PHP_VERSION_ID < 80000) { + $this->expectNotice(); + $this->expectNoticeMessage('Undefined property: Drupal\Core\Routing\CompiledRoute::$route'); + } + else { + $this->expectWarning(); + $this->expectWarningMessage('Undefined property: Drupal\Core\Routing\CompiledRoute::$route'); + } $this->compiled_route->getDefaults(); } @@ -100,8 +112,14 @@ public function testDefaultsDynamicallySet() { * @expectedDeprecation Drupal\Core\Routing\CompiledRoute::getRequirements() is deprecated in drupal:9.1.0 and is removed from drupal:10.0.0. No direct replacement is provided. See https://www.drupal.org/node/3159706 */ public function testRequirementsDeprecated() { - $this->expectNotice(); - $this->expectNoticeMessage('Undefined property: Drupal\Core\Routing\CompiledRoute::$route'); + if (PHP_VERSION_ID < 80000) { + $this->expectNotice(); + $this->expectNoticeMessage('Undefined property: Drupal\Core\Routing\CompiledRoute::$route'); + } + else { + $this->expectWarning(); + $this->expectWarningMessage('Undefined property: Drupal\Core\Routing\CompiledRoute::$route'); + } $this->compiled_route->getRequirements(); }