Issue #3114041 by swatichouhan012, longwave, chr.fritsch, alexpott, mondrake: PhpUnit 8 tests breaking because of compatibility issue with setUp()
parent
e8a6b798ab
commit
449b333d5b
|
@ -43,9 +43,14 @@ final class ClassWriter {
|
||||||
$alteredCode = file_get_contents($alteredFile = $vendor_dir . '/phpunit/phpunit/src/Framework/TestCase.php');
|
$alteredCode = file_get_contents($alteredFile = $vendor_dir . '/phpunit/phpunit/src/Framework/TestCase.php');
|
||||||
$alteredCode = preg_replace('/^ ((?:protected|public)(?: static)? function \w+\(\)): void/m', ' $1', $alteredCode);
|
$alteredCode = preg_replace('/^ ((?:protected|public)(?: static)? function \w+\(\)): void/m', ' $1', $alteredCode);
|
||||||
$alteredCode = str_replace("__DIR__ . '/../Util/", "'$vendor_dir/phpunit/phpunit/src/Util/", $alteredCode);
|
$alteredCode = str_replace("__DIR__ . '/../Util/", "'$vendor_dir/phpunit/phpunit/src/Util/", $alteredCode);
|
||||||
$filename = __DIR__ . '/../../../../../../sites/simpletest/TestCase.php';
|
$simpletest_directory = __DIR__ . '/../../../../../../sites/simpletest';
|
||||||
// Only write when necessary.
|
// Only write when necessary.
|
||||||
|
$filename = $simpletest_directory . '/TestCase.php';
|
||||||
if (!file_exists($filename) || md5_file($filename) !== md5($alteredCode)) {
|
if (!file_exists($filename) || md5_file($filename) !== md5($alteredCode)) {
|
||||||
|
// Create directory when necessary.
|
||||||
|
if (!file_exists($simpletest_directory)) {
|
||||||
|
mkdir($simpletest_directory, 0777, TRUE);
|
||||||
|
}
|
||||||
file_put_contents($filename, $alteredCode);
|
file_put_contents($filename, $alteredCode);
|
||||||
}
|
}
|
||||||
include $filename;
|
include $filename;
|
||||||
|
|
Loading…
Reference in New Issue