$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();
$source['constants'
]['source_base_path'
] =
$fs->
realpath($info['base_path'
]);
$migration->
set('source',
$source);
$this->
executeMigration($migration);
} /**
* Tests a single file entity.
*
* @param int $id
* The file ID.
* @param string $name
* The expected file name.
* @param string $uri
* The expected URI.
* @param string $mime
* The expected MIME type.
* @param string $size
* The expected file size.
* @param string $created
* The expected creation time.
* @param string $changed
* The expected modification time.
* @param string $uid
* The expected owner ID.
*/