From 511ecab8a35b7b30bc213c21648dc0ec88ab9318 Mon Sep 17 00:00:00 2001
From: Dave Long <dave@longwaveconsulting.com>
Date: Mon, 11 Mar 2024 17:04:01 +0000
Subject: [PATCH] Issue #3427054 by mondrake: Replace calls to ::expectError*()
 in MachineNameTest

---
 core/phpstan-baseline.neon                                | 8 --------
 .../KernelTests/Core/Render/Element/MachineNameTest.php   | 2 +-
 2 files changed, 1 insertion(+), 9 deletions(-)

diff --git a/core/phpstan-baseline.neon b/core/phpstan-baseline.neon
index 83cd841eac93..8cd9bc453211 100644
--- a/core/phpstan-baseline.neon
+++ b/core/phpstan-baseline.neon
@@ -2217,14 +2217,6 @@ parameters:
 			count: 1
 			path: tests/Drupal/KernelTests/Core/Image/ToolkitGdTest.php
 
-		-
-			message: """
-				#^Call to deprecated method expectErrorMessage\\(\\) of class PHPUnit\\\\Framework\\\\TestCase\\:
-				https\\://github\\.com/sebastianbergmann/phpunit/issues/5062$#
-			"""
-			count: 1
-			path: tests/Drupal/KernelTests/Core/Render/Element/MachineNameTest.php
-
 		-
 			message: "#^Variable \\$value in isset\\(\\) always exists and is not nullable\\.$#"
 			count: 1
diff --git a/core/tests/Drupal/KernelTests/Core/Render/Element/MachineNameTest.php b/core/tests/Drupal/KernelTests/Core/Render/Element/MachineNameTest.php
index 74c3e95a963b..247b6cc064c8 100644
--- a/core/tests/Drupal/KernelTests/Core/Render/Element/MachineNameTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Render/Element/MachineNameTest.php
@@ -66,7 +66,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
    */
   public function testMachineNameOrderException() {
     $this->expectException(\LogicException::class);
-    $this->expectErrorMessage('The machine name element "test_machine_name" is defined before the source element "test_source", it must be defined after or the source element must specify an id.');
+    $this->expectExceptionMessage('The machine name element "test_machine_name" is defined before the source element "test_source", it must be defined after or the source element must specify an id.');
     $form = \Drupal::formBuilder()->getForm($this);
     $this->render($form);
   }
-- 
GitLab