You are here

protected function MigrateUpgradeTestBase::assertFileMigrations in Drupal 10

Same name and namespace in other branches
  1. 9 core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php \Drupal\Tests\migrate_drupal_ui\Functional\MigrateUpgradeTestBase::assertFileMigrations()

Checks public and private files are copied but not temporary files.

File

core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php, line 344

Class

MigrateUpgradeTestBase
Provides a base class for testing migration upgrades in the UI.

Namespace

Drupal\Tests\migrate_drupal_ui\Functional

Code

protected function assertFileMigrations() {
  $fs = \Drupal::service('file_system');
  $files = $this
    ->getManagedFiles();
  foreach ($files as $file) {
    preg_match('/^(private|public|temporary):/', $file['uri'], $matches);
    $scheme = $matches[1];
    $filepath = $fs
      ->realpath($file['uri']);
    if ($scheme === 'temporary') {
      $this
        ->assertFileDoesNotExist($filepath);
    }
    else {
      $this
        ->assertFileExists($filepath);
    }
  }
}