MDL-46193 phpunit: Use random starting value on initialization.
This commit is contained in:
@@ -461,8 +461,13 @@ class phpunit_util extends testing_util {
|
||||
$suites .= $suite;
|
||||
}
|
||||
}
|
||||
// Start a sequence between 100000 and 199000 to ensure each call to init produces
|
||||
// different ids in the database. This reduces the risk that hard coded values will
|
||||
// end up being placed in phpunit or behat test code.
|
||||
$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);
|
||||
|
||||
$result = false;
|
||||
if (is_writable($CFG->dirroot)) {
|
||||
|
||||
Reference in New Issue
Block a user