You are here

function BackupMigrateFunctionalityTest::testManualBackup in Backup and Migrate 5

File

tests/BackupMigrateFunctionalityTest.test, line 56

Class

BackupMigrateFunctionalityTest
Unit tests for Backup and Migrate module.

Code

function testManualBackup() {
  $directory = _backup_migrate_get_save_path();
  $edit = array(
    'backup_migrate_file_name' => $this
      ->randomName(5, 'backup'),
    'backup_migrate_exclude_tables[]' => array(),
    'backup_migrate_nodata_tables[]' => array(),
    'backup_migrate_compression' => "none",
    'backup_migrate_timestamp_format' => '',
    'backup_migrate_destination' => "save",
    'backup_migrate_append_timestamp' => false,
    'backup_migrate_save_settings' => false,
  );
  $this
    ->drupalLoginUser($this->admin_user);
  $this
    ->drupalPostRequest("admin/content/backup_migrate", $edit, t('Backup Database'));
  $this
    ->assertTrue(file_exists($directory . "/manual/" . $edit['backup_migrate_file_name'] . '.sql'), t("Checking that a backup file was created", array(
    '!key' => $key,
  )));
  $edit['backup_migrate_compression'] = 'gzip';
  $this
    ->drupalPostRequest("admin/content/backup_migrate", $edit, t('Backup Database'));
  $this
    ->assertTrue(file_exists($directory . "/manual/" . $edit['backup_migrate_file_name'] . '.sql.gz'), t("Checking that a backup file was created", array(
    '!key' => $key,
  )));
  $edit['backup_migrate_compression'] = 'bzip';
  $this
    ->drupalPostRequest("admin/content/backup_migrate", $edit, t('Backup Database'));
  $this
    ->assertTrue(file_exists($directory . "/manual/" . $edit['backup_migrate_file_name'] . '.sql.bz'), t("Checking that a backup file was created", array(
    '!key' => $key,
  )));
  $edit['backup_migrate_compression'] = 'zip';
  $this
    ->drupalPostRequest("admin/content/backup_migrate", $edit, t('Backup Database'));
  $this
    ->assertTrue(file_exists($directory . "/manual/" . $edit['backup_migrate_file_name'] . '.sql.zip'), t("Checking that a backup file was created", array(
    '!key' => $key,
  )));
  $this
    ->delete_directory($directory);
}