summaryrefslogtreecommitdiff
path: root/run-tests.php
diff options
context:
space:
mode:
authorMatteo Beccati <mbeccati@php.net>2014-05-27 11:07:19 +0200
committerMatteo Beccati <mbeccati@php.net>2014-05-27 11:07:19 +0200
commit56bcb22afb5040d49439f0a0d238f8a013ebec48 (patch)
tree74059161e31a9aaf850539084a7b74b02d82e5d2 /run-tests.php
parent91e7b3b84f08a2fabed8ed2196a827e481a4b79c (diff)
parent1696166466e179c361c562f01a14995a09c41ae3 (diff)
downloadphp-git-56bcb22afb5040d49439f0a0d238f8a013ebec48.tar.gz
Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4: Fixed broken XML junit output due to escaping of CDATA sections
Diffstat (limited to 'run-tests.php')
-rwxr-xr-xrun-tests.php15
1 files changed, 8 insertions, 7 deletions
diff --git a/run-tests.php b/run-tests.php
index af49b03f5a..207758839c 100755
--- a/run-tests.php
+++ b/run-tests.php
@@ -1532,7 +1532,7 @@ TEST $file
}
$message = !empty($m[1]) ? $m[1] : '';
- junit_mark_test_as('SKIP', $shortname, $tested, null, "<![CDATA[\n$message\n]]>");
+ junit_mark_test_as('SKIP', $shortname, $tested, null, $message);
return 'SKIPPED';
}
@@ -1557,7 +1557,7 @@ TEST $file
) {
$message = "ext/zlib required";
show_result('SKIP', $tested, $tested_file, "reason: $message", $temp_filenames);
- junit_mark_test_as('SKIP', $shortname, $tested, null, "<![CDATA[\n$message\n]]>");
+ junit_mark_test_as('SKIP', $shortname, $tested, null, $message);
return 'SKIPPED';
}
@@ -2125,7 +2125,7 @@ $output
$php = $old_php;
}
- $diff = empty($diff) ? '' : "<![CDATA[\n " . preg_replace('/\e/', '<esc>', $diff) . "\n]]>";
+ $diff = empty($diff) ? '' : preg_replace('/\e/', '<esc>', $diff);
junit_mark_test_as($restype, str_replace($cwd . '/', '', $tested_file), $tested, null, $info, $diff);
@@ -2704,6 +2704,7 @@ function junit_mark_test_as($type, $file_name, $test_name, $time = null, $messag
junit_suite_record($suite, 'execution_time', $time);
$escaped_details = htmlspecialchars($details, ENT_QUOTES, 'UTF-8');
+ $escaped_message = htmlspecialchars($message, ENT_QUOTES, 'UTF-8');
$escaped_test_name = basename($file_name) . ' - ' . htmlspecialchars($test_name, ENT_QUOTES);
$JUNIT['files'][$file_name]['xml'] = "<testcase classname='$suite' name='$escaped_test_name' time='$time'>\n";
@@ -2720,16 +2721,16 @@ function junit_mark_test_as($type, $file_name, $test_name, $time = null, $messag
junit_suite_record($suite, 'test_pass');
} elseif ('BORK' == $type) {
junit_suite_record($suite, 'test_error');
- $JUNIT['files'][$file_name]['xml'] .= "<error type='$output_type' message='$message'/>\n";
+ $JUNIT['files'][$file_name]['xml'] .= "<error type='$output_type' message='$escaped_message'/>\n";
} elseif ('SKIP' == $type) {
junit_suite_record($suite, 'test_skip');
- $JUNIT['files'][$file_name]['xml'] .= "<skipped>$message</skipped>\n";
+ $JUNIT['files'][$file_name]['xml'] .= "<skipped>$escaped_message</skipped>\n";
} elseif('FAIL' == $type) {
junit_suite_record($suite, 'test_fail');
- $JUNIT['files'][$file_name]['xml'] .= "<failure type='$output_type' message='$message'>$escaped_details</failure>\n";
+ $JUNIT['files'][$file_name]['xml'] .= "<failure type='$output_type' message='$escaped_message'>$escaped_details</failure>\n";
} else {
junit_suite_record($suite, 'test_error');
- $JUNIT['files'][$file_name]['xml'] .= "<error type='$output_type' message='$message'>$escaped_details</error>\n";
+ $JUNIT['files'][$file_name]['xml'] .= "<error type='$output_type' message='$escaped_message'>$escaped_details</error>\n";
}
$JUNIT['files'][$file_name]['xml'] .= "</testcase>\n";