Commit dba39da0 authored by Rajesh Taneja's avatar Rajesh Taneja
Browse files

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
parent 10344212
......@@ -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);
}
}
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment