You are here

function BackupMigrateFunctionalityTest::setUp in Backup and Migrate 5

Same name and namespace in other branches
  1. 6.3 tests/backup_migrate.functionality.test \BackupMigrateFunctionalityTest::setUp()
  2. 6.2 tests/backup_migrate.functionality.test \BackupMigrateFunctionalityTest::setUp()

SimpleTest core method: code run before each and every test method.

File

tests/BackupMigrateFunctionalityTest.test, line 26

Class

BackupMigrateFunctionalityTest
Unit tests for Backup and Migrate module.

Code

function setUp() {
  parent::setUp();

  // Create an administrative user with permission to do all functions
  $permissions = array(
    'perform backup',
    'access backup files',
    'delete backup files',
    'restore from backup',
  );
  $this->admin_user = $this
    ->drupalCreateUserRolePerm($permissions);

  // move the existing backup dir out of the way
  $directory = _backup_migrate_get_save_path();
  if (is_dir($directory)) {
    $this->directory_backup = $directory . $this
      ->randomName(5, '_');
    rename($directory, $this->directory_backup);
  }
}