Merge branch 'wip_MDL-47538_m28_phpunitseq' of git://github.com/skodak/moodle
This commit is contained in:
@@ -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), '/');
|
||||
|
||||
@@ -458,7 +458,7 @@ abstract class testing_util {
|
||||
// To reduce the chance of the coding error, we start sequences at different values where possible.
|
||||
// In a attempt to avoid tables with existing id's we start at a high number.
|
||||
// Reset the value each time all database sequences are reset.
|
||||
if (defined('PHPUNIT_SEQUENCE_START')) {
|
||||
if (defined('PHPUNIT_SEQUENCE_START') and PHPUNIT_SEQUENCE_START) {
|
||||
self::$sequencenextstartingid = PHPUNIT_SEQUENCE_START;
|
||||
} else {
|
||||
self::$sequencenextstartingid = 100000;
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@
|
||||
|
||||
<php>
|
||||
<!--<const name="PHPUNIT_LONGTEST" value="1"/> uncomment to execute also slow or otherwise expensive tests-->
|
||||
<const name="PHPUNIT_SEQUENCE_START" value="<!--@PHPUNIT_SEQUENCE_START@-->"/>
|
||||
<const name="PHPUNIT_SEQUENCE_START" value=""/>
|
||||
|
||||
<!--Following constants instruct tests to fetch external test files from alternative location or skip tests if empty, clone https://github.com/moodlehq/moodle-exttests to local web server-->
|
||||
<!--<const name="TEST_EXTERNAL_FILES_HTTP_URL" value="http://download.moodle.org/unittest"/> uncomment and alter to fetch external test files from alternative location-->
|
||||
|
||||
Reference in New Issue
Block a user