You are here

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

Verify that backups can be restored.

File

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

Class

BackupMigrateQuickBackupTest
Tests backup migrate quick backup functionality.

Namespace

Drupal\Tests\backup_migrate\Functional

Code

public function testBackupsCanBeRestored() {
  $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 "restore" link.
  $session
    ->linkExists('Restore');

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

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