You are here

protected function FileMigrationTestTrait::prepareMigration in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/file/tests/src/Kernel/Migrate/d6/FileMigrationTestTrait.php \Drupal\Tests\file\Kernel\Migrate\d6\FileMigrationTestTrait::prepareMigration()

File

core/modules/file/tests/src/Kernel/Migrate/d6/FileMigrationTestTrait.php, line 25

Class

FileMigrationTestTrait
Helper for setting up a file migration test.

Namespace

Drupal\Tests\file\Kernel\Migrate\d6

Code

protected function prepareMigration(MigrationInterface $migration) {

  // File migrations need a source_base_path.
  // @see MigrateUpgradeRunBatch::run
  $destination = $migration
    ->getDestinationConfiguration();
  if ($destination['plugin'] === 'entity:file') {

    // Make sure we have a single trailing slash.
    $source = $migration
      ->getSourceConfiguration();
    $source['site_path'] = 'core/modules/simpletest';
    $source['constants']['source_base_path'] = $this->root . '/';
    $migration
      ->set('source', $source);
  }
}