From 5dd92df9f7ccb2987ac53473361679011472311e Mon Sep 17 00:00:00 2001
From: Alex Pott <alex.a.pott@googlemail.com>
Date: Sun, 12 May 2024 07:43:39 +0100
Subject: [PATCH] Issue #3446542 by mondrake: Replace @before*|@after* test
 annotations with attributes

(cherry picked from commit 356ba1fc6564f593eca039509aaa4b3f0001a53b)
---
 core/tests/Drupal/KernelTests/KernelTestBase.php             | 4 ++--
 .../Drupal/TestTools/Extension/RequiresComposerTrait.php     | 5 ++---
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/core/tests/Drupal/KernelTests/KernelTestBase.php b/core/tests/Drupal/KernelTests/KernelTestBase.php
index 0ccee09bbe52..94ee7a7d8746 100644
--- a/core/tests/Drupal/KernelTests/KernelTestBase.php
+++ b/core/tests/Drupal/KernelTests/KernelTestBase.php
@@ -27,6 +27,7 @@
 use Drupal\TestTools\Extension\DeprecationBridge\ExpectDeprecationTrait;
 use Drupal\TestTools\Extension\SchemaInspector;
 use Drupal\TestTools\TestVarDumper;
+use PHPUnit\Framework\Attributes\After;
 use PHPUnit\Framework\Exception;
 use PHPUnit\Framework\TestCase;
 use Prophecy\PhpUnit\ProphecyTrait;
@@ -697,10 +698,9 @@ protected function tearDown(): void {
   }
 
   /**
-   * @after
-   *
    * Additional tear down method to close the connection at the end.
    */
+  #[After]
   public function tearDownCloseDatabaseConnection() {
     // Destroy the database connection, which for example removes the memory
     // from sqlite in memory.
diff --git a/core/tests/Drupal/TestTools/Extension/RequiresComposerTrait.php b/core/tests/Drupal/TestTools/Extension/RequiresComposerTrait.php
index 39eb33dfcd34..8166cd9a05a5 100644
--- a/core/tests/Drupal/TestTools/Extension/RequiresComposerTrait.php
+++ b/core/tests/Drupal/TestTools/Extension/RequiresComposerTrait.php
@@ -4,6 +4,7 @@
 
 namespace Drupal\TestTools\Extension;
 
+use PHPUnit\Framework\Attributes\BeforeClass;
 use Symfony\Component\Process\ExecutableFinder;
 
 /**
@@ -11,9 +12,7 @@
  */
 trait RequiresComposerTrait {
 
-  /**
-   * @beforeClass
-   */
+  #[BeforeClass]
   public static function requiresComposer(): void {
     if (!((new ExecutableFinder())->find('composer'))) {
       static::markTestSkipped('This test requires the Composer executable to be accessible.');
-- 
GitLab