MDL-58169 phpunit: Clear opcode cache before checking file

In unit test, we write cache file often and
opcache might fail to detect changes. It will
be nice to invalidate opcode cache to ensure
we have the correct file_exists status
This commit is contained in:
Rajesh Taneja 2017-03-14 13:30:24 +08:00
parent 1034421264
commit dba39da081

View file

@ -288,6 +288,20 @@ class cache_config_testing extends cache_config_writer {
global $CFG;
return $CFG->wwwroot.'phpunit';
}
/**
* Checks if the configuration file exists.
*
* @return bool True if it exists
*/
public static function config_file_exists() {
// Allow for late static binding by using static.
$configfilepath = static::get_config_file_path();
// Invalidate opcode php cache, so we get correct status of file.
core_component::invalidate_opcode_php_cache($configfilepath);
return file_exists($configfilepath);
}
}
/**