getFileMigrationInfo example

class MigrateFileGetIdsTest extends MigrateFileTest {

  /** * {@inheritdoc} */
  protected static $modules = ['file', 'file_test_get_ids'];

  /** * {@inheritdoc} */
  protected function getFileMigrationInfo() {
    $migration_info = parent::getFileMigrationInfo();
    $migration_info['plugin_id'] = 'd7_file_used';
    return $migration_info;
  }

}

  abstract protected function getFileMigrationInfo();

  /** * Prepare the file migration for running. */
  protected function fileMigrationSetup() {
    $this->installEntitySchema('file');
    $this->installSchema('file', ['file_usage']);

    $info = $this->getFileMigrationInfo();
    $fs = $this->container->get('file_system');
    // Ensure that the files directory exists.     $fs->mkdir(dirname($info['path']), NULL, TRUE);
    // Put test file in the source directory.     file_put_contents($info['path']str_repeat('*', $info['size']));

    /** @var \Drupal\migrate\Plugin\Migration $migration */
    $migration = $this->getMigration($info['plugin_id']);
    // Set the source plugin's source_base_path configuration value, which     // would normally be set by the user running the migration.     $source = $migration->getSourceConfiguration();
    
Home | Imprint | This part of the site doesn't use cookies.