public function DrushWithMigrateUpgradeFromFileTest::assertVideoMediaMigrations in Media Migration 8
Tests video file to media migrations (of locally stored videos).
Parameters
\Drupal\migrate_plus\Entity\MigrationInterface[] $media_migrations: Array of migration entities tagged with MediaMigration::MIGRATION_TAG.
1 call to DrushWithMigrateUpgradeFromFileTest::assertVideoMediaMigrations()
- DrushWithMigrateUpgradeFromFileTest::testMigrationWithDrush in tests/
src/ Functional/ DrushWithMigrateUpgradeFromFileTest.php - Tests migrations with Migrate Upgrade, Drush and Migrate Tools.
File
- tests/
src/ Functional/ DrushWithMigrateUpgradeFromFileTest.php, line 1757
Class
- DrushWithMigrateUpgradeFromFileTest
- Tests Migrate Upgrade compatibility and verifies usage steps of README.
Namespace
Drupal\Tests\media_migration\FunctionalCode
public function assertVideoMediaMigrations(array $media_migrations) {
$this
->assertEquals([
'id' => 'upgrade_d7_file_plain_type_video',
'migration_group' => 'migrate_drupal_7',
'migration_tags' => [
'Drupal 7',
'Configuration',
MediaMigration::MIGRATION_TAG_MAIN,
MediaMigration::MIGRATION_TAG_CONFIG,
],
'source' => [
'plugin' => 'd7_file_plain_type',
'constants' => [
'status' => TRUE,
],
'mimes' => 'video',
'schemes' => 'public',
'destination_media_type_id' => 'video',
],
'process' => [
'status' => [
[
'plugin' => 'get',
'source' => 'constants/status',
],
],
'id' => [
[
'plugin' => 'get',
'source' => 'bundle',
],
],
'label' => [
[
'plugin' => 'get',
'source' => 'bundle_label',
],
],
'source' => [
[
'plugin' => 'get',
'source' => 'source_plugin_id',
],
],
'source_configuration/source_field' => [
[
'plugin' => 'get',
'source' => 'source_field_name',
],
],
],
'destination' => [
'plugin' => 'entity:media_type',
],
'migration_dependencies' => [
'required' => [],
'optional' => [],
],
'dependencies' => [],
], $this
->getImportantEntityProperties($media_migrations['upgrade_d7_file_plain_type_video']));
$this
->assertEquals([
'id' => 'upgrade_d7_file_plain_source_field_video',
'migration_group' => 'migrate_drupal_7',
'migration_tags' => [
'Drupal 7',
'Configuration',
MediaMigration::MIGRATION_TAG_MAIN,
MediaMigration::MIGRATION_TAG_CONFIG,
],
'source' => [
'plugin' => 'd7_file_plain_source_field_storage',
'constants' => [
'entity_type_id' => 'media',
'status' => TRUE,
'langcode' => 'und',
'cardinality' => 1,
],
'mimes' => 'video',
'schemes' => 'public',
'destination_media_type_id' => 'video',
],
'process' => [
'status' => [
[
'plugin' => 'get',
'source' => 'constants/status',
],
],
'field_name' => [
[
'plugin' => 'get',
'source' => 'source_field_name',
],
],
'langcode' => [
[
'plugin' => 'get',
'source' => 'constants/langcode',
],
],
'entity_type' => [
[
'plugin' => 'get',
'source' => 'constants/entity_type_id',
],
],
'type' => [
[
'plugin' => 'get',
'source' => 'field_type',
],
],
'cardinality' => [
[
'plugin' => 'get',
'source' => 'constants/cardinality',
],
],
'settings' => [
[
'plugin' => 'get',
'source' => 'settings',
],
],
],
'destination' => [
'plugin' => 'entity:field_storage_config',
],
'migration_dependencies' => [
'required' => [
'upgrade_d7_file_plain_type_video',
],
'optional' => [],
],
'dependencies' => [],
], $this
->getImportantEntityProperties($media_migrations['upgrade_d7_file_plain_source_field_video']));
$this
->assertEquals([
'id' => 'upgrade_d7_file_plain_source_field_config_video',
'migration_group' => 'migrate_drupal_7',
'migration_tags' => [
'Drupal 7',
'Configuration',
MediaMigration::MIGRATION_TAG_MAIN,
MediaMigration::MIGRATION_TAG_CONFIG,
],
'source' => [
'plugin' => 'd7_file_plain_source_field_instance',
'constants' => [
'entity_type_id' => 'media',
'required' => TRUE,
],
'mimes' => 'video',
'schemes' => 'public',
'destination_media_type_id' => 'video',
],
'process' => [
'label' => [
[
'plugin' => 'get',
'source' => 'source_field_label',
],
],
'field_name' => [
[
'plugin' => 'get',
'source' => 'source_field_name',
],
],
'entity_type' => [
[
'plugin' => 'get',
'source' => 'constants/entity_type_id',
],
],
'required' => [
[
'plugin' => 'get',
'source' => 'constants/required',
],
],
'bundle' => [
[
'plugin' => 'get',
'source' => 'bundle',
],
],
'settings' => [
[
'plugin' => 'get',
'source' => 'settings',
],
],
],
'destination' => [
'plugin' => 'entity:field_config',
],
'migration_dependencies' => [
'required' => [
'upgrade_d7_file_plain_source_field_video',
],
'optional' => [],
],
'dependencies' => [],
], $this
->getImportantEntityProperties($media_migrations['upgrade_d7_file_plain_source_field_config_video']));
$this
->assertEquals([
'id' => 'upgrade_d7_file_plain_formatter_video',
'migration_group' => 'migrate_drupal_7',
'migration_tags' => [
'Drupal 7',
'Configuration',
MediaMigration::MIGRATION_TAG_MAIN,
MediaMigration::MIGRATION_TAG_CONFIG,
],
'source' => [
'plugin' => 'd7_file_plain_field_formatter',
'constants' => [
'entity_type_id' => 'media',
'view_mode' => 'default',
],
'mimes' => 'video',
'schemes' => 'public',
'destination_media_type_id' => 'video',
],
'process' => [
'entity_type' => [
[
'plugin' => 'get',
'source' => 'constants/entity_type_id',
],
],
'bundle' => [
[
'plugin' => 'get',
'source' => 'bundle',
],
],
'view_mode' => [
[
'plugin' => 'get',
'source' => 'constants/view_mode',
],
],
'field_name' => [
[
'plugin' => 'get',
'source' => 'field_name',
],
],
'hidden' => [
[
'plugin' => 'get',
'source' => 'hidden',
],
],
'options' => [
[
'plugin' => 'get',
'source' => 'options',
],
],
],
'destination' => [
'plugin' => 'component_entity_display',
],
'migration_dependencies' => [
'required' => [
'upgrade_d7_file_plain_source_field_config_video',
],
'optional' => [],
],
'dependencies' => [],
], $this
->getImportantEntityProperties($media_migrations['upgrade_d7_file_plain_formatter_video']));
// Widget settings migration.
$this
->assertEquals([
'id' => 'upgrade_d7_file_plain_widget_video',
'migration_group' => 'migrate_drupal_7',
'migration_tags' => [
'Drupal 7',
'Configuration',
MediaMigration::MIGRATION_TAG_MAIN,
MediaMigration::MIGRATION_TAG_CONFIG,
],
'source' => [
'plugin' => 'd7_file_plain_field_widget',
'constants' => [
'entity_type_id' => 'media',
'form_mode' => 'default',
],
'mimes' => 'video',
'schemes' => 'public',
'destination_media_type_id' => 'video',
],
'process' => [
'entity_type' => [
[
'plugin' => 'get',
'source' => 'constants/entity_type_id',
],
],
'bundle' => [
[
'plugin' => 'get',
'source' => 'bundle',
],
],
'form_mode' => [
[
'plugin' => 'get',
'source' => 'constants/form_mode',
],
],
'field_name' => [
[
'plugin' => 'get',
'source' => 'source_field_name',
],
],
'options' => [
[
'plugin' => 'get',
'source' => 'options',
],
],
],
'destination' => [
'plugin' => 'component_entity_form_display',
],
'migration_dependencies' => [
'required' => [
'upgrade_d7_file_plain_source_field_config_video',
],
'optional' => [],
],
'dependencies' => [],
], $this
->getImportantEntityProperties($media_migrations['upgrade_d7_file_plain_widget_video']));
$this
->assertEquals([
'id' => 'upgrade_d7_file_plain_video_public',
'migration_group' => 'migrate_drupal_7',
'migration_tags' => [
'Drupal 7',
'Content',
MediaMigration::MIGRATION_TAG_MAIN,
MediaMigration::MIGRATION_TAG_CONTENT,
],
'source' => [
'plugin' => 'd7_file_plain',
'mime' => 'video',
'scheme' => 'public',
'destination_media_type_id' => 'video',
],
'process' => [
'uuid' => [
[
'plugin' => 'media_migrate_uuid',
'source' => 'fid',
],
],
'mid' => [
[
'plugin' => 'get',
'source' => 'fid',
],
],
'uid' => [
[
'plugin' => 'migration_lookup',
'source' => 'uid',
'migration' => 'upgrade_d7_user',
],
[
'plugin' => 'default_value',
'default_value' => 1,
],
],
'bundle' => [
[
'plugin' => 'get',
'source' => 'bundle',
],
],
'name' => [
[
'plugin' => 'get',
'source' => 'filename',
],
],
'created' => [
[
'plugin' => 'get',
'source' => 'timestamp',
],
],
'status' => [
[
'plugin' => 'get',
'source' => 'status',
],
],
'field_media_video_file/target_id' => [
[
'plugin' => 'get',
'source' => 'fid',
],
],
'field_media_video_file/display' => [
[
'plugin' => 'get',
'source' => 'display',
],
],
'field_media_video_file/description' => [
[
'plugin' => 'get',
'source' => 'description',
],
],
],
'destination' => [
'plugin' => 'entity:media',
],
'migration_dependencies' => [
'required' => [
'upgrade_d7_file_plain_type_video',
'upgrade_d7_file_plain_source_field_config_video',
'upgrade_d7_file',
],
'optional' => [
'upgrade_d7_user',
],
],
'dependencies' => [],
], $this
->getImportantEntityProperties($media_migrations['upgrade_d7_file_plain_video_public']));
}