public function DrushWithCoreMigrationsFromMediaTest::testMigrationWithDrush in Media Migration 8
Test media migrations with Drush and Migrate Tools.
File
- tests/
src/ Functional/ DrushWithCoreMigrationsFromMediaTest.php, line 38
Class
- DrushWithCoreMigrationsFromMediaTest
- Tests Migrate Tools and Drush compatibility – verifies usage steps in README.
Namespace
Drupal\Tests\media_migration\FunctionalCode
public function testMigrationWithDrush() {
// Verify that the expected migrations are generated.
// @code
// drush migrate:status\
// --names-only\
// --group=default
// --tag="Media Migration"
// @endcode
$this
->drush('migrate:status', [
'--names-only',
], [
'group' => 'default',
'tag' => MediaMigration::MIGRATION_TAG_MAIN,
]);
$this
->assertDrushMigrateStatusOutputHasAllLines([
'Group: Default (default) d7_media_view_modes',
'Group: Default (default) d7_file_entity_type:image',
'Group: Default (default) d7_file_entity_type:audio',
'Group: Default (default) d7_file_entity_source_field:audio',
'Group: Default (default) d7_file_entity_type:document',
'Group: Default (default) d7_file_entity_source_field:document',
'Group: Default (default) d7_file_entity_source_field:image',
'Group: Default (default) d7_file_entity_type:remote_video',
'Group: Default (default) d7_file_entity_source_field:remote_video',
'Group: Default (default) d7_file_entity_type:video',
'Group: Default (default) d7_file_entity_source_field:video',
'Group: Default (default) d7_file_entity_source_field_config:audio',
'Group: Default (default) d7_file_entity_formatter:audio',
'Group: Default (default) d7_file_entity_source_field_config:document',
'Group: Default (default) d7_file_entity_formatter:document',
'Group: Default (default) d7_file_entity_source_field_config:image',
'Group: Default (default) d7_file_entity_formatter:image',
'Group: Default (default) d7_file_entity_source_field_config:remote_video',
'Group: Default (default) d7_file_entity_formatter:remote_video',
'Group: Default (default) d7_file_entity_source_field_config:video',
'Group: Default (default) d7_file_entity_formatter:video',
'Group: Default (default) d7_file_entity:audio:public',
'Group: Default (default) d7_file_entity:document:public',
'Group: Default (default) d7_file_entity:image:public',
'Group: Default (default) d7_file_entity:video:youtube',
'Group: Default (default) d7_file_entity:video:vimeo',
'Group: Default (default) d7_file_entity:video:public',
'Group: Default (default) d7_file_entity_widget:audio',
'Group: Default (default) d7_file_entity_widget:document',
'Group: Default (default) d7_file_entity_widget:image',
'Group: Default (default) d7_file_entity_widget:remote_video',
'Group: Default (default) d7_file_entity_widget:video',
]);
$this
->assertArticleBodyFieldMigrationProcesses('d7_node_complete:article');
// Execute the migrate import "media config" drush command.
// @code
// drush migrate:import\
// --execute-dependencies\
// --group=default\
// --tag="Media Configuration"
// @endcode
$this
->drush('migrate:import', [
'--execute-dependencies',
], [
'group' => 'default',
'tag' => MediaMigration::MIGRATION_TAG_CONFIG,
]);
// Execute the migration import "dependent config entity types" drush
// command.
// @code
// drush migrate:import\
// --group=default\
// d7_node_type,d7_comment_type
// @endcode
$this
->drush('migrate:import', [
'd7_node_type,d7_comment_type',
], [
'group' => 'default',
]);
// Execute the migration import "field storage and instance" drush command.
// @code
// drush migrate:import\
// --group=default\
// d7_field,d7_field_instance
// @endcode
$this
->drush('migrate:import', [
'd7_field,d7_field_instance',
], [
'group' => 'default',
]);
// Execute the migrations of media entities.
// @code
// drush migrate:import\
// --execute-dependencies\
// --group=default\
// --tag="Media Entity"
// @endcode
$this
->drush('migrate:import', [
'--execute-dependencies',
], [
'group' => 'default',
'tag' => MediaMigration::MIGRATION_TAG_CONTENT,
]);
$this
->resetAll();
$this
->assertMedia1FieldValues();
$this
->assertMedia2FieldValues();
$this
->assertMedia3FieldValues();
$this
->assertMedia4FieldValues();
$this
->assertMedia5FieldValues();
$this
->assertMedia6FieldValues();
$this
->assertMedia7FieldValues();
$this
->assertMedia8FieldValues();
$this
->assertMedia9FieldValues();
$this
->assertMedia10FieldValues();
$this
->assertMedia11FieldValues();
$this
->assertMedia12FieldValues();
}