You are here

function BackupMigrateUnitTest::testDefaultTables in Backup and Migrate 5

File

tests/BackupMigrateUnitTest.test, line 602

Class

BackupMigrateUnitTest
Unit tests for Backup and Migrate module.

Code

function testDefaultTables() {

  // not much to do here but make sure the return value is an array of plausible table names
  $safe_pattern = "/[a-z\\_]+/";
  $tables = _backup_migrate_default_exclude_tables();
  $this
    ->assertTrue(is_array($tables), t('Testing that default exclude tables is an array'));
  foreach ($tables as $table) {
    $this
      ->assertTrue(is_string($table), t('Testing that table name is a string'));
    $this
      ->assertTrue(preg_match($safe_pattern, $table), t('Testing that table name: %name is valid', array(
      '%name' => $name,
    )));
  }
  $tables = _backup_migrate_default_structure_only_tables();
  $this
    ->assertTrue(is_array($tables), t('Testing that default structure only tables is an array'));
  foreach ($tables as $table) {
    $this
      ->assertTrue(is_string($table), t('Testing that table name is a string'));
    $this
      ->assertTrue(preg_match($safe_pattern, $table), t('Testing that table name: %name is valid', array(
      '%name' => $name,
    )));
  }
}