diff --git a/core/tests/Drupal/Tests/Core/Test/PhpUnitCliTest.php b/core/tests/Drupal/Tests/Core/Test/PhpUnitCliTest.php index 59a22c3bc9..923815c3bb 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(); + $run_results = 'COMMAND: ' . $process->getCommandLine() . "\n" . + 'OUTPUT: ' . $process->getOutput() . "\n" . + 'ERROR: ' . $process->getErrorOutput() . "\n"; + + $this->assertEquals(0, $process->getExitCode(), $run_results); + $this->assertStringContainsString('HTML output was generated', $run_results); + $this->assertStringContainsString('Drupal_Tests_image_Functional_ImageDimensionsTest-1', $process->getOutput(), $run_results); + } + }