diff --git a/core/lib/Drupal/Core/Test/PhpUnitTestRunner.php b/core/lib/Drupal/Core/Test/PhpUnitTestRunner.php
index 84171a17b4c1a4c57a3ca5b3f931e95868ce3e1e..a6c27ab6a9161b372814c116a39506db4b72c71e 100644
--- a/core/lib/Drupal/Core/Test/PhpUnitTestRunner.php
+++ b/core/lib/Drupal/Core/Test/PhpUnitTestRunner.php
@@ -4,7 +4,6 @@
 
 use Drupal\Core\Database\Database;
 use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
-use Drupal\Tests\Listeners\SimpletestUiPrinter;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 use Symfony\Component\Process\PhpExecutableFinder;
 
@@ -145,8 +144,6 @@ public function runCommand(array $unescaped_test_classnames, $phpunit_file, &$st
       $phpunit_bin,
       '--log-junit',
       escapeshellarg($phpunit_file),
-      '--printer',
-      escapeshellarg(SimpletestUiPrinter::class),
     ];
 
     // Optimized for running a single test.
diff --git a/core/tests/Drupal/Tests/Core/Test/PhpUnitCliTest.php b/core/tests/Drupal/Tests/Core/Test/PhpUnitCliTest.php
index 59a22c3bc993ca8cf3fc2380f22306e042e69d3a..933c9ba8262ba9dd8ee7c5787967fe59148b01ca 100644
--- a/core/tests/Drupal/Tests/Core/Test/PhpUnitCliTest.php
+++ b/core/tests/Drupal/Tests/Core/Test/PhpUnitCliTest.php
@@ -32,4 +32,25 @@ public function testPhpUnitListTests() {
     );
   }
 
+  /**
+   * Ensures that functional tests produce debug HTML output when required.
+   */
+  public function testFunctionalTestDebugHtmlOutput() {
+    if (getenv('BROWSERTEST_OUTPUT_DIRECTORY') === FALSE) {
+      $this->markTestSkipped('This test requires the environment variable BROWSERTEST_OUTPUT_DIRECTORY to be set.');
+    }
+    $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-1', $process->getOutput());
+  }
+
 }
diff --git a/core/tests/Drupal/Tests/Listeners/HtmlOutputPrinterTrait.php b/core/tests/Drupal/Tests/Listeners/HtmlOutputPrinterTrait.php
index 6cdd1e80029c1c60b8ecdb1c985c21296fe90dab..4bdfa54e00e37cc363234dac71b31f08d465e232 100644
--- a/core/tests/Drupal/Tests/Listeners/HtmlOutputPrinterTrait.php
+++ b/core/tests/Drupal/Tests/Listeners/HtmlOutputPrinterTrait.php
@@ -2,8 +2,6 @@
 
 namespace Drupal\Tests\Listeners;
 
-use Drupal\Component\Utility\Html;
-
 /**
  * Defines a class for providing html output results for functional tests.
  *
@@ -80,18 +78,4 @@ protected function printHtmlOutput() {
     }
   }
 
-  /**
-   * Prints HTML output links for the Simpletest UI.
-   */
-  public function simpletestUiWrite($buffer) {
-    $buffer = Html::escape($buffer);
-    // Turn HTML output URLs into clickable link <a> tags.
-    $url_pattern = '@https?://[^\s]+@';
-    $buffer = preg_replace($url_pattern, '<a href="$0" target="_blank" title="$0">$0</a>', $buffer);
-    // Make the output readable in HTML by breaking up lines properly.
-    $buffer = nl2br($buffer);
-
-    print $buffer;
-  }
-
 }
diff --git a/core/tests/Drupal/Tests/Listeners/SimpletestUiPrinter.php b/core/tests/Drupal/Tests/Listeners/SimpletestUiPrinter.php
deleted file mode 100644
index 13383b4c313f9bac53c2c55ac5817a9a77216e9c..0000000000000000000000000000000000000000
--- a/core/tests/Drupal/Tests/Listeners/SimpletestUiPrinter.php
+++ /dev/null
@@ -1,17 +0,0 @@
-<?php
-
-namespace Drupal\Tests\Listeners;
-
-/**
- * Defines a class for providing html output links in the Simpletest UI.
- */
-class SimpletestUiPrinter extends HtmlOutputPrinter {
-
-  /**
-   * {@inheritdoc}
-   */
-  public function write(string $buffer): void {
-    $this->simpletestUiWrite($buffer);
-  }
-
-}