Commit da501fe7 authored by effulgentsia's avatar effulgentsia

Issue #2566319 by alexpott: run-tests.sh should have a non-HTML mode

parent e8dfde42
......@@ -5,6 +5,7 @@
* This script runs Drupal tests from command line.
*/
use Drupal\Component\Utility\Html;
use Drupal\Component\Utility\Timer;
use Drupal\Component\Uuid\Php;
use Drupal\Core\Database\Database;
......@@ -203,6 +204,9 @@ function simpletest_script_help() {
if you want to also view any pages rendered in the simpletest
browser you need to add --verbose to the command line.
--non-html Removes escaping from output. Useful for reading results on the
CLI.
<test1>[,<test2>[,<test3> ...]]
One or more tests to be run. By default, these are interpreted
......@@ -267,6 +271,7 @@ function simpletest_script_parse_args() {
'test-id' => 0,
'execute-test' => '',
'xml' => '',
'non-html' => FALSE,
);
// Override with set values.
......@@ -1101,14 +1106,18 @@ function simpletest_script_reporter_display_results() {
* @param $result The result object to format.
*/
function simpletest_script_format_result($result) {
global $results_map, $color;
global $args, $results_map, $color;
$summary = sprintf("%-9.9s %-10.10s %-17.17s %4.4s %-35.35s\n",
$results_map[$result->status], $result->message_group, basename($result->file), $result->line, $result->function);
simpletest_script_print($summary, simpletest_script_color_code($result->status));
$lines = explode("\n", wordwrap(trim(strip_tags($result->message)), 76));
$message = trim(strip_tags($result->message));
if ($args['non-html']) {
$message = Html::decodeEntities($message, ENT_QUOTES, 'UTF-8');
}
$lines = explode("\n", wordwrap($message), 76);
foreach ($lines as $line) {
echo " $line\n";
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment