1 backdrop_web_test_case_cache.php protected BackdropWebTestCaseCache::alterToMyISAM()

Alter tables to MyISAM engine to speed up tests.

MyISAM is faster to delete and copy tables. Its advantage is small when using /var/lib/mysql on an SHM (memory) device but is much bigger when tests are run on a regular device.

File

core/modules/simpletest/backdrop_web_test_case_cache.php, line 171

Class

BackdropWebTestCaseCache
Class for setting up a full installation profile for caching purposes.

Code

protected function alterToMyISAM() {
  if (Database::getConnection()->driver() != 'mysql') {
    return;
  }
  $skip_alter = array(
    'taxonomy_term_data',
    'node',
    'node_access',
    'node_revision',
    'node_comment_statistics',
  );
  $tables = db_find_tables($this->databasePrefix . '%');
  foreach ($tables as $table) {
    $original_table_name = substr($table, strlen($this->databasePrefix));
    if (!in_array($original_table_name, $skip_alter)) {
      db_query('ALTER TABLE ' . $table . ' ENGINE=MyISAM');
    }
  }
}