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