You are here

public function BackupMigrateQuickBackupTest::testBackupsCanBeDeleted in Backup and Migrate 5.0.x

Verify that backups can be deleted.

File

tests/src/Functional/BackupMigrateQuickBackupTest.php, line 114

Class

BackupMigrateQuickBackupTest
Tests backup migrate quick backup functionality.

Namespace

Drupal\Tests\backup_migrate\Functional

Code

public function testBackupsCanBeDeleted() {
  $this
    ->testQuickBackup();

  // Load the destination page for the private files destination.
  $this
    ->drupalGet('admin/config/development/backup_migrate/settings/destination/backups/private_files');
  $session = $this
    ->assertSession();
  $session
    ->statusCodeEquals(200);

  // Confirm a file exists with a "delete" link.
  $session
    ->linkExists('Delete');

  // Load the route for deleting an existing backup.
  $this
    ->clickLink('Delete');
  $session = $this
    ->assertSession();
  $session
    ->statusCodeEquals(200);
  $session
    ->pageTextContains('Are you sure you want to delete this backup?');

  // Make sure the text without a filename is not present, which would
  // indicate that the filename was not passed correctly.
  $session
    ->pageTextNotContains('This will permanently remove from Private Files Directory.');

  // Delete the backup.
  $this
    ->submitForm([], 'Delete');
  $session = $this
    ->assertSession();
  $session
    ->statusCodeEquals(200);
  $session
    ->addressEquals('admin/config/development/backup_migrate/settings/destination/backups/private_files');
  $session
    ->pageTextContains('There are no backups in this destination.');
}