From dc85a3c65bd726f22ca04a5d408e79a27618b697 Mon Sep 17 00:00:00 2001
From: Dave Long <dave@longwaveconsulting.com>
Date: Mon, 11 Mar 2024 16:56:39 +0000
Subject: [PATCH] Issue #3427044 by mondrake: Replace calls to ::expectError*()
 in ConnectionTest

---
 core/phpstan-baseline.neon                                | 8 --------
 .../Drupal/KernelTests/Core/Database/ConnectionTest.php   | 4 ++--
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/core/phpstan-baseline.neon b/core/phpstan-baseline.neon
index 15db53472cb0..83cd841eac93 100644
--- a/core/phpstan-baseline.neon
+++ b/core/phpstan-baseline.neon
@@ -2172,14 +2172,6 @@ parameters:
 			count: 1
 			path: tests/Drupal/KernelTests/Core/Config/ConfigInstallTest.php
 
-		-
-			message: """
-				#^Call to deprecated method expectError\\(\\) of class PHPUnit\\\\Framework\\\\TestCase\\:
-				https\\://github\\.com/sebastianbergmann/phpunit/issues/5062$#
-			"""
-			count: 2
-			path: tests/Drupal/KernelTests/Core/Database/ConnectionTest.php
-
 		-
 			message: "#^Variable \\$expected_driver might not be defined\\.$#"
 			count: 2
diff --git a/core/tests/Drupal/KernelTests/Core/Database/ConnectionTest.php b/core/tests/Drupal/KernelTests/Core/Database/ConnectionTest.php
index 11423f0b8910..742c400d0785 100644
--- a/core/tests/Drupal/KernelTests/Core/Database/ConnectionTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Database/ConnectionTest.php
@@ -125,7 +125,7 @@ public function testPerTablePrefixOption() {
       'test_table' => $connection_info['default']['prefix'] . '_bar',
     ];
     Database::addConnectionInfo('default', 'foo', $new_connection_info);
-    $this->expectError();
+    $this->expectException(\AssertionError::class);
     $foo_connection = Database::getConnection('foo', 'default');
   }
 
@@ -139,7 +139,7 @@ public function testPrefixArrayOption() {
       'default' => $connection_info['default']['prefix'],
     ];
     Database::addConnectionInfo('default', 'foo', $new_connection_info);
-    $this->expectError();
+    $this->expectException(\AssertionError::class);
     $foo_connection = Database::getConnection('foo', 'default');
   }
 
-- 
GitLab