MDL-47538 phpunit: fix invalid PHPUNIT_SEQUENCE_START constant

This commit is contained in:
Petr Skoda
2014-10-06 17:31:15 +13:00
parent 6597413d41
commit ddffa9d6d3
3 changed files with 10 additions and 4 deletions
+8 -2
View File
@@ -467,7 +467,10 @@ class phpunit_util extends testing_util {
$sequencestart = 100000 + mt_rand(0, 99) * 1000;
$data = preg_replace('|<!--@plugin_suites_start@-->.*<!--@plugin_suites_end@-->|s', $suites, $data, 1);
$data = preg_replace('|<!--@PHPUNIT_SEQUENCE_START@-->|s', $sequencestart, $data, 1);
$data = str_replace(
'<const name="PHPUNIT_SEQUENCE_START" value=""/>',
'<const name="PHPUNIT_SEQUENCE_START" value="' . $sequencestart . '"/>',
$data);
$result = false;
if (is_writable($CFG->dirroot)) {
@@ -523,7 +526,10 @@ class phpunit_util extends testing_util {
// Apply it to the file template
$fcontents = str_replace('<!--@component_suite@-->', $ctemplate, $ftemplate);
$fcontents = preg_replace('|<!--@PHPUNIT_SEQUENCE_START@-->|s', $sequencestart, $fcontents, 1);
$fcontents = str_replace(
'<const name="PHPUNIT_SEQUENCE_START" value=""/>',
'<const name="PHPUNIT_SEQUENCE_START" value="' . $sequencestart . '"/>',
$fcontents);
// fix link to schema
$level = substr_count(str_replace('\\', '/', $cpath), '/') - substr_count(str_replace('\\', '/', $CFG->dirroot), '/');