3 namespace Drupal\Tests\file\Kernel\Migrate\d6;
4 use Drupal\migrate\Plugin\MigrationInterface;
7 * Helper for setting up a file migration test.
9 trait FileMigrationTestTrait {
12 * Setup and execute d6_file migration.
14 protected function setUpMigratedFiles() {
15 $this->installEntitySchema('file');
16 $this->installConfig(['file']);
18 $this->executeMigration('d6_file');
24 protected function prepareMigration(MigrationInterface $migration) {
25 // File migrations need a source_base_path.
26 // @see MigrateUpgradeRunBatch::run
27 $destination = $migration->getDestinationConfiguration();
28 if ($destination['plugin'] === 'entity:file') {
29 // Make sure we have a single trailing slash.
30 $source = $migration->getSourceConfiguration();
31 $source['site_path'] = 'core/modules/simpletest';
32 $source['constants']['source_base_path'] = \Drupal::root() . '/';
33 $migration->set('source', $source);