Skip to content
Snippets Groups Projects
Commit b5c3f1b3 authored by catch's avatar catch
Browse files

Issue #3254723 by mondrake, murilohp, longwave: Remove SimpletestUiPrinter

parent b9e078a0
No related branches found
No related tags found
No related merge requests found
......@@ -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.
......
......@@ -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());
}
}
......@@ -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;
}
}
<?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);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment