1.20.x backdrop_web_test_case.php | protected BackdropWebTestCase::useCache() |
Copies the cached tables and config for a profile if one is available.
Return value
TRUE when cache used, FALSE when cache is not available.:
See also
BackdropWebTestCase::tearDown()
File
- modules/
simpletest/ backdrop_web_test_case.php, line 1620
Class
- BackdropWebTestCase
- Test case for typical Backdrop tests.
Code
protected function useCache() {
$config_cache_dir = $this->originalFileDirectory . '/simpletest/simpletest_cache_' . $this->profile;
if (is_dir($config_cache_dir)) {
$schema = self::getDatabaseConnection()->schema();
$prefix = 'simpletest_cache_' . $this->profile . '_';
$tables = $schema->findTables($prefix . '%');
foreach ($tables as $table_prefix) {
$table = substr($table_prefix, strlen($prefix));
$schema->cloneTable($table_prefix, $this->databasePrefix . $table);
}
$this->recursiveCopy($config_cache_dir, $this->public_files_directory);
return TRUE;
}
return FALSE;
}