You are here

function BackupMigrateUnitTest::testGetTables in Backup and Migrate 5

File

tests/BackupMigrateUnitTest.test, line 640

Class

BackupMigrateUnitTest
Unit tests for Backup and Migrate module.

Code

function testGetTables() {
  $test_table = $this
    ->randomName(10, 'testtable_');
  db_query("CREATE TABLE {$test_table} (testid int(10));");
  $table_names = _backup_migrate_get_table_names();
  $tables = _backup_migrate_get_tables();
  foreach ($table_names as $table) {
    $this
      ->assertTrue(isset($tables[$table]), t('Testing that table: %name is present', array(
      '%name' => $name,
    )));
    $this
      ->assertTrue(isset($tables[$table]['Name']), t('Testing that table name is present', array(
      '%name' => $name,
    )));
    $this
      ->assertTrue(array_key_exists('Auto_increment', $tables[$table]), t('Testing that table auto increment is present', array(
      '%name' => $name,
    )));
  }
  $this
    ->assertTrue(isset($tables[$test_table]), t('Testing that the test table is present'));
  db_query("DROP TABLE {$test_table};");
}