You are here

function BackupMigrateUnitTest::testTempFileDelete in Backup and Migrate 5

File

tests/BackupMigrateUnitTest.test, line 331

Class

BackupMigrateUnitTest
Unit tests for Backup and Migrate module.

Code

function testTempFileDelete() {

  // create some files to be deleted
  $dir = file_directory_path() . "/backup_migrate/manual/";
  _backup_migrate_check_destination_dir('manual');
  for ($i = 0; $i < 10; $i++) {
    $file = $dir . $this
      ->randomName(5, 'somefile_');
    $files[] = $file;
    touch($file);
  }
  $this
    ->assertEqual($this
    ->countFiles($dir), 10, t('Checking the number of files created is 10'));
  _backup_migrate_temp_files_delete($files);
  $this
    ->assertEqual($this
    ->countFiles($dir), 0, t('Checking the number of files created is 0'));
  $this
    ->delete_directory(file_directory_path() . "/backup_migrate");
}