diff --git a/core/tests/Drupal/FunctionalTests/Test/FunctionalTestDebugHtmlOutputHelperTest.php b/core/tests/Drupal/FunctionalTests/Test/FunctionalTestDebugHtmlOutputHelperTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..4d9013072e18e41c893d7364469d5f92704d1473
--- /dev/null
+++ b/core/tests/Drupal/FunctionalTests/Test/FunctionalTestDebugHtmlOutputHelperTest.php
@@ -0,0 +1,28 @@
+<?php
+
+namespace Drupal\FunctionalTests\Test;
+
+use Drupal\Tests\BrowserTestBase;
+
+/**
+ * Helper test for FunctionalTestDebugHtmlOutputTest.
+ *
+ * @see \Drupal\FunctionalTests\Test\FunctionalTestDebugHtmlOutputTest::testFunctionalTestDebugHtmlOutput
+ *
+ * @group browsertestbase
+ */
+class FunctionalTestDebugHtmlOutputHelperTest extends BrowserTestBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  protected $defaultTheme = 'stark';
+
+  /**
+   * Creates one page of debug HTML output.
+   */
+  public function testCreateFunctionalTestDebugHtmlOutput(): void {
+    $this->drupalGet('<front>');
+  }
+
+}
diff --git a/core/tests/Drupal/FunctionalTests/Test/FunctionalTestDebugHtmlOutputTest.php b/core/tests/Drupal/FunctionalTests/Test/FunctionalTestDebugHtmlOutputTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..a1c9ab6ab35a2cc71e56e6ceaf4786056accffe4
--- /dev/null
+++ b/core/tests/Drupal/FunctionalTests/Test/FunctionalTestDebugHtmlOutputTest.php
@@ -0,0 +1,53 @@
+<?php
+
+namespace Drupal\FunctionalTests\Test;
+
+use Drupal\Tests\BrowserTestBase;
+use Symfony\Component\Process\Process;
+
+/**
+ * Test to ensure that functional tests produce debug HTML output when required.
+ *
+ * @group browsertestbase
+ */
+class FunctionalTestDebugHtmlOutputTest extends BrowserTestBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  protected $defaultTheme = 'stark';
+
+  /**
+   * Ensures that functional tests produce debug HTML output when required.
+   *
+   * Note: this test must be a BrowserTestBase to ensure all requirements for
+   * running a functional test are met.
+   */
+  public function testFunctionalTestDebugHtmlOutput(): void {
+    // Test with the specified output directory.
+    $process = Process::fromShellCommandline('vendor/bin/phpunit --configuration core --verbose core/tests/Drupal/FunctionalTests/Test/FunctionalTestDebugHtmlOutputHelperTest.php');
+    $process->setWorkingDirectory($this->root)
+      ->setTimeout(300)
+      ->setIdleTimeout(300);
+    $process->run();
+    $this->assertEquals(0, $process->getExitCode(),
+      'COMMAND: ' . $process->getCommandLine() . "\n" .
+      'OUTPUT: ' . $process->getOutput() . "\n" .
+      'ERROR: ' . $process->getErrorOutput() . "\n");
+    $this->assertStringContainsString('HTML output was generated', $process->getOutput());
+    $this->assertStringContainsString('Drupal_FunctionalTests_Test_FunctionalTestDebugHtmlOutputHelperTest', $process->getOutput());
+
+    // Test with a wrong output directory.
+    $process = Process::fromShellCommandline('vendor/bin/phpunit --configuration core --verbose core/tests/Drupal/FunctionalTests/Test/FunctionalTestDebugHtmlOutputHelperTest.php');
+    $process->setWorkingDirectory($this->root)
+      ->setTimeout(300)
+      ->setIdleTimeout(300);
+    $process->run(NULL, ['BROWSERTEST_OUTPUT_DIRECTORY' => 'can_we_assume_that_a_subdirectory_with_this_name_does_not_exist']);
+    $this->assertEquals(0, $process->getExitCode(),
+      'COMMAND: ' . $process->getCommandLine() . "\n" .
+      'OUTPUT: ' . $process->getOutput() . "\n" .
+      'ERROR: ' . $process->getErrorOutput() . "\n");
+    $this->assertStringContainsString('HTML output directory can_we_assume_that_a_subdirectory_with_this_name_does_not_exist is not a writable directory.', $process->getOutput());
+  }
+
+}
diff --git a/core/tests/Drupal/Tests/Core/Test/PhpUnitCliTest.php b/core/tests/Drupal/Tests/Core/Test/PhpUnitCliTest.php
index 3ace88234c605762befda5f284825151e5071136..0931f20e02799680977bb2456517c987f3390a0d 100644
--- a/core/tests/Drupal/Tests/Core/Test/PhpUnitCliTest.php
+++ b/core/tests/Drupal/Tests/Core/Test/PhpUnitCliTest.php
@@ -34,38 +34,4 @@ public function testPhpUnitListTests() {
     );
   }
 
-  /**
-   * Ensures that functional tests produce debug HTML output when required.
-   */
-  public function testFunctionalTestDebugHtmlOutput() {
-    if (!getenv('BROWSERTEST_OUTPUT_DIRECTORY')) {
-      $this->markTestSkipped('This test requires the environment variable BROWSERTEST_OUTPUT_DIRECTORY to be set.');
-    }
-
-    // Test with the specified output directory.
-    $process = Process::fromShellCommandline('vendor/bin/phpunit --configuration core --verbose core/modules/image/tests/src/Functional/ImageDimensionsTest.php');
-    $process->setWorkingDirectory($this->root)
-      ->setTimeout(300)
-      ->setIdleTimeout(300);
-    $process->run();
-    $this->assertEquals(0, $process->getExitCode(),
-      'COMMAND: ' . $process->getCommandLine() . "\n" .
-      'OUTPUT: ' . $process->getOutput() . "\n" .
-      'ERROR: ' . $process->getErrorOutput() . "\n");
-    $this->assertStringContainsString('HTML output was generated', $process->getOutput());
-    $this->assertStringContainsString('Drupal_Tests_image_Functional_ImageDimensionsTest', $process->getOutput());
-
-    // Test with a wrong output directory.
-    $process = Process::fromShellCommandline('vendor/bin/phpunit --configuration core --verbose core/modules/image/tests/src/Functional/ImageDimensionsTest.php');
-    $process->setWorkingDirectory($this->root)
-      ->setTimeout(300)
-      ->setIdleTimeout(300);
-    $process->run(NULL, ['BROWSERTEST_OUTPUT_DIRECTORY' => 'can_we_assume_that_a_subdirectory_with_this_name_does_not_exist']);
-    $this->assertEquals(0, $process->getExitCode(),
-      'COMMAND: ' . $process->getCommandLine() . "\n" .
-      'OUTPUT: ' . $process->getOutput() . "\n" .
-      'ERROR: ' . $process->getErrorOutput() . "\n");
-    $this->assertStringContainsString('HTML output directory can_we_assume_that_a_subdirectory_with_this_name_does_not_exist is not a writable directory.', $process->getOutput());
-  }
-
 }