diff --git a/tests/src/Kernel/Migrate/d7/MigrateMetatagTest.php b/tests/src/Kernel/Migrate/d7/MigrateMetatagTest.php index 59fe2f0..0f7b79b 100644 --- a/tests/src/Kernel/Migrate/d7/MigrateMetatagTest.php +++ b/tests/src/Kernel/Migrate/d7/MigrateMetatagTest.php @@ -7,7 +7,6 @@ use Drupal\taxonomy\Entity\Term; use Drupal\taxonomy\TermInterface; use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase; -use Drupal\Tests\file\Kernel\Migrate\d7\FileMigrationSetupTrait; use Drupal\user\Entity\User; use Drupal\user\UserInterface; @@ -18,9 +17,6 @@ */ class MigrateMetatagTest extends MigrateDrupal7TestBase { - // Leverage some methods from the file migration system. - use FileMigrationSetupTrait; - /** * {@inheritdoc} */ @@ -39,6 +35,34 @@ class MigrateMetatagTest extends MigrateDrupal7TestBase { 'metatag', ]; + /** + * Prepare the file migration for running. + * + * Copied from FileMigrationSetupTrait from 8.4 so that this doesn't have to + * then also extend getFileMigrationInfo(). + */ + protected function fileMigrationSetup() { + $this->installSchema('file', ['file_usage']); + $this->installEntitySchema('file'); + $this->container->get('stream_wrapper_manager') + ->registerWrapper('public', PublicStream::class, StreamWrapperInterface::NORMAL); + + $fs = \Drupal::service('file_system'); + // The public file directory active during the test will serve as the + // root of the fictional Drupal 7 site we're migrating. + $fs->mkdir('public://sites/default/files', NULL, TRUE); + file_put_contents('public://sites/default/files/cube.jpeg', str_repeat('*', 3620)); + + /** @var \Drupal\migrate\Plugin\Migration $migration */ + $migration = $this->getMigration('d7_file'); + // Set the source plugin's source_base_path configuration value, which + // would normally be set by the user running the migration. + $source = $migration->getSourceConfiguration(); + $source['constants']['source_base_path'] = $fs->realpath('public://'); + $migration->set('source', $source); + $this->executeMigration($migration); + } + /** * {@inheritdoc} */