From 6025a14896098671b81b587aaed6a6e598eefa88 Mon Sep 17 00:00:00 2001
From: Alex Pott <alex.a.pott@googlemail.com>
Date: Mon, 18 Nov 2024 10:41:37 +0000
Subject: [PATCH] Issue #3462973 by mattlc, ultimike, smustgrave, dww,
 larowlan, alexpott: Provide details of where core tests, not in core modules,
 should live

---
 .../Drupal/BuildTests/Framework/BuildTestBase.php      |  8 ++++++++
 .../FunctionalJavascriptTests/WebDriverTestBase.php    |  4 ++++
 core/tests/Drupal/KernelTests/KernelTestBase.php       |  4 ++++
 core/tests/Drupal/Tests/BrowserTestBase.php            |  4 ++++
 core/tests/Drupal/Tests/UnitTestCase.php               | 10 +++++++---
 5 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/core/tests/Drupal/BuildTests/Framework/BuildTestBase.php b/core/tests/Drupal/BuildTests/Framework/BuildTestBase.php
index b1fea7d324aa..313c6f54fa9d 100644
--- a/core/tests/Drupal/BuildTests/Framework/BuildTestBase.php
+++ b/core/tests/Drupal/BuildTests/Framework/BuildTestBase.php
@@ -23,6 +23,14 @@
 /**
  * Provides a workspace to test build processes.
  *
+ * Module tests extending BuildTestBase must exist in the
+ * Drupal\Tests\your_module\Build namespace and live in the
+ * modules/your_module/tests/src/Build directory.
+ *
+ * Tests for core/lib/Drupal classes extending BuildTestBase must exist in the
+ * \Drupal\BuildTests namespace and live in the core/tests/Drupal/BuildTests
+ * directory.
+ *
  * If you need to build a file system and then run a command from the command
  * line then this is the test framework for you.
  *
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php b/core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php
index b5e34c997683..53c66638ed45 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php
@@ -16,6 +16,10 @@
  * Drupal\Tests\your_module\FunctionalJavascript namespace and live in the
  * modules/your_module/tests/src/FunctionalJavascript directory.
  *
+ * Tests for core/lib/Drupal classes extending WebDriverTestBase must exist in
+ * the \Drupal\FunctionalJavascriptTests\Core namespace and live in the
+ * core/tests/Drupal/FunctionalJavascriptTests directory.
+ *
  * Base class for testing browser interaction implemented in JavaScript.
  *
  * @ingroup testing
diff --git a/core/tests/Drupal/KernelTests/KernelTestBase.php b/core/tests/Drupal/KernelTests/KernelTestBase.php
index f9da8131eda9..94be1c7ddf7a 100644
--- a/core/tests/Drupal/KernelTests/KernelTestBase.php
+++ b/core/tests/Drupal/KernelTests/KernelTestBase.php
@@ -47,6 +47,10 @@
  * Drupal\Tests\your_module\Kernel namespace and live in the
  * modules/your_module/tests/src/Kernel directory.
  *
+ * Tests for core/lib/Drupal classes extending KernelTestBase must exist in the
+ * \Drupal\KernelTests\Core namespace and live in the
+ * core/tests/Drupal/KernelTests directory.
+ *
  * This base class should be useful for testing some types of integrations which
  * don't require the overhead of a fully-installed Drupal instance, but which
  * have many dependencies on parts of Drupal which can't or shouldn't be mocked.
diff --git a/core/tests/Drupal/Tests/BrowserTestBase.php b/core/tests/Drupal/Tests/BrowserTestBase.php
index 2e8e9a103400..bb5042668718 100644
--- a/core/tests/Drupal/Tests/BrowserTestBase.php
+++ b/core/tests/Drupal/Tests/BrowserTestBase.php
@@ -34,6 +34,10 @@
  * Drupal\Tests\your_module\Functional namespace and live in the
  * modules/your_module/tests/src/Functional directory.
  *
+ * Tests for core/lib/Drupal classes extending BrowserTestBase must exist in the
+ * \Drupal\FunctionalTests\Core namespace and live in the
+ * core/tests/Drupal/FunctionalTests directory.
+ *
  * Tests extending this base class should only translate text when testing
  * translation functionality. For example, avoid wrapping test text with t()
  * or TranslatableMarkup().
diff --git a/core/tests/Drupal/Tests/UnitTestCase.php b/core/tests/Drupal/Tests/UnitTestCase.php
index ff2baec864c6..63371281bfe3 100644
--- a/core/tests/Drupal/Tests/UnitTestCase.php
+++ b/core/tests/Drupal/Tests/UnitTestCase.php
@@ -19,9 +19,13 @@
 /**
  * Provides a base class and helpers for Drupal unit tests.
  *
- * Module tests extending BrowserTestBase must exist in the
- * Drupal\Tests\your_module\Functional namespace and live in the
- * modules/your_module/tests/src/Functional directory.
+ * Module tests extending UnitTestCase must exist in the
+ * Drupal\Tests\your_module\Unit namespace and live in the
+ * modules/your_module/tests/src/Unit directory.
+ *
+ * Tests for core/lib/Drupal classes extending UnitTestCase must exist in the
+ * \Drupal\Tests\Core namespace and live in the core/lib/tests/Drupal/Tests/Core
+ * directory.
  *
  * Using Symfony's dump() function in Unit tests will produce output on the
  * command line.
-- 
GitLab