MDL-60978 testing: Support ability to run phpunit in isolated process
This commit is contained in:
@@ -56,7 +56,7 @@ abstract class advanced_testcase extends base_testcase {
|
||||
|
||||
$this->setBackupGlobals(false);
|
||||
$this->setBackupStaticAttributes(false);
|
||||
$this->setRunTestInSeparateProcess(false);
|
||||
$this->setPreserveGlobalState(false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -490,19 +490,6 @@ abstract class advanced_testcase extends base_testcase {
|
||||
return phpunit_util::start_event_redirection();
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleanup after all tests are executed.
|
||||
*
|
||||
* Note: do not forget to call this if overridden...
|
||||
*
|
||||
* @static
|
||||
* @return void
|
||||
*/
|
||||
public static function tearDownAfterClass() {
|
||||
self::resetAllData();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reset all database tables, restore global state and clear caches and optionally purge dataroot dir.
|
||||
*
|
||||
|
||||
@@ -881,4 +881,16 @@ class phpunit_util extends testing_util {
|
||||
$method->setAccessible(true);
|
||||
return $method->invokeArgs($object, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the current process is an isolated test process.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function is_in_isolated_process(): bool {
|
||||
// Note: There is no function to call, or much to go by in order to tell whether we are in an isolated process
|
||||
// during Bootstrap, when this function is called.
|
||||
// We can do so by testing the existence of the wrapper function, but there is nothing set until that point.
|
||||
return function_exists('__phpunit_run_isolated_test');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user