MDL-56273 cache: Use cache initialise always.

purge_all() and purge_by_definition() look in the configuration
for which caches are available and then creates them to purge them.
The configuration stores the values used by initialise(), not
initialise_unit_test_instance() and would therefore fail to purge
all caches if they were not purged by another means.

In the case of filestore, it's purged by unit tests, in the case
of memcache(d), it purges the whole store when a single definition
is requested.

Therefore all configuration was moved into the configuration file
during unit tests and does not have any special override codes in
the unit test infrastructure.
This commit is contained in:
Russell Smith
2016-10-30 13:42:43 +11:00
parent 577bd70d38
commit a169739d5d
18 changed files with 123 additions and 147 deletions
+4 -2
View File
@@ -1315,8 +1315,10 @@ class core_cache_testcase extends advanced_testcase {
$configfile = $CFG->dataroot.'/muc/config.php';
// That's right, we're deleting the config file.
$this->assertTrue(@unlink($configfile));
// The config file will not exist yet as we've not done anything with the cache.
// reset_all_data removes the file and without a call to create a configuration it doesn't exist
// as yet.
$this->assertFileNotExists($configfile);
// Disable the cache
cache_phpunit_factory::phpunit_disable();