mirror of
https://github.com/moodle/moodle.git
synced 2025-08-02 07:39:54 +02:00
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:
parent
1034421264
commit
dba39da081
1 changed files with 14 additions and 0 deletions
14
cache/tests/fixtures/lib.php
vendored
14
cache/tests/fixtures/lib.php
vendored
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue