Comments

yash.rode created an issue. See original summary.

yash.rode’s picture

1st patch requires youtube field patch applied and 2nd patch works without youtube field patch.

yash.rode’s picture

Title: Mgrate Video Embed Field from D7 to Media in D9. » Migrate Video Embed Field from D7 to Media in D9.

The last submitted patch, 2: Video_embed_field_to_media_with_Yoututbe_field_patch_applied-3273427-2.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Status: Needs review » Needs work

The last submitted patch, 2: Video_embed_field_to_media_without_Yoututbe_field_patch_applied-3273427-2.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

yash.rode’s picture

yash.rode’s picture

Status: Needs work » Needs review
huzooka’s picture

StatusFileSize
new70.03 KB

Rebased #6

huzooka’s picture

Status: Needs review » Needs work

Re #4: Very nice work, thank you, @yash.rode!

I only have some really small nits:

  1. +++ b/media_migration.module
    @@ -118,3 +118,7 @@ function media_migration_migrate_d7_filter_format_prepare_row(Row $row, MigrateS
    +
    +function media_migration_migrate_field_info_alter(array &$definitions) {
    +  unset($definitions['video_embed_field']);
    +}
    

    Could you please add the approrpiate Implements hook_.... function comment and also leave a comment why this is necessary?

  2. +++ b/migrations/d7_media_embed_field.yml
    @@ -0,0 +1,19 @@
    +  - Drupal 7
    +  - Content
    

    Could you please add 'Media Migration' and 'Media Entity' migration tags?

    @see Drupal\media_migration\MediaMigration::MIGRATION_TAG_MAIN and Drupal\media_migration\MediaMigration::MIGRATION_TAG_CONTENT

  3. +++ b/src/Plugin/migrate/source/VideoEmbedField.php
    @@ -0,0 +1,89 @@
    +    return [
    +      'field_vid_emb_video_url' => 'URL of video',
    +    ];
    

    I don't think that we have a field_vid_emb_video_ulr column in the migration rows returned by this source plugin.

  4. +++ b/tests/src/Kernel/VideoEmbedFieldTest.php
    @@ -0,0 +1,94 @@
    + * @group video_embed_field
    

    Group annotation of tests should reflect the actual module. This should be @group media_migration.

  5. +++ b/tests/src/Kernel/VideoEmbedFieldTest.php
    @@ -0,0 +1,94 @@
    +  protected static $modules = [
    +    'media',
    +    'media_migration',
    +    'media_migration_test_oembed',
    +    'menu_ui',
    +    'node',
    +    'smart_sql_idmap',
    +    'image',
    +    'file',
    +    'field',
    +    'text',
    +    'filter',
    +    'taxonomy',
    +    'comment',
    +  ];
    

    menu_ui and taxonomy modules are irrelevant; file and field modules are installed by the parent class Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase.

  6. +++ b/tests/src/Kernel/VideoEmbedFieldTest.php
    @@ -0,0 +1,94 @@
    +    $this->executeMigrations([
    +      'd7_field',
    +      'd7_view_modes',
    +      'd7_filter_format',
    +      'd7_node_type',
    +      'd7_comment_type',
    +      'd7_field_instance',
    +      'd7_file',
    +      'd7_user_role',
    +      'd7_user',
    +      'd7_node_complete',
    +    ]);
    

    You don't have to execute d7_file or d7_filter_format.

    And I'm missing an assertion about migration messages after these migrations are executed. Could you please add it? It can be either $this->assertExpectedMigrationMessages() or $this->assertEmpty($this->migrateMessages), but if you chose the latter, then you can get rid of MigMagKernelTestDxTrait.

yash.rode’s picture

StatusFileSize
new70.12 KB
new2.99 KB

follow up for #9.

huzooka’s picture

Status: Needs work » Reviewed & tested by the community

Thank you, @yash.rode! #10 addressed my concerns.

huzooka’s picture

Status: Reviewed & tested by the community » Needs work

A couple of nits I missed in my review in #9:

  1. diff --git a/migrations/d7_media_embed_field.yml b/migrations/d7_media_embed_field.yml
    new file mode 100644
    
    new file mode 100644
    index 0000000..998c7ee
    
    index 0000000..998c7ee
    --- /dev/null
    
    --- /dev/null
    +++ b/migrations/d7_media_embed_field.yml
    
    +++ b/migrations/d7_media_embed_field.yml
    +++ b/migrations/d7_media_embed_field.yml
    @@ -0,0 +1,21 @@
    
    @@ -0,0 +1,21 @@
    +id: d7_video_embed_field
    +label: Video Embed Field migration
    

    The name of the migration YAML is d7_media_embed_field.yml, but the ID is d7_video_embed_field. Could you please rename the file to make it matching the migration ID?

  2. +++ b/src/Plugin/migrate/source/VideoEmbedField.php
    @@ -0,0 +1,89 @@
    +  /**
    +   * {@inheritDoc}
    +   */
    

    {inheritDoc} should be lowercased: {inheritdoc}

  3. +++ b/tests/fixtures/drupal7.php
    @@ -0,0 +1,30 @@
    +include 'drupal7' . DIRECTORY_SEPARATOR . 'system.php';
    
    +++ b/tests/fixtures/drupal7/system.php
    @@ -0,0 +1,222 @@
    +->values(array(
    +  'filename' => 'sites/all/modules/contrib/video_embed_field/video_embed_brightcove/video_embed_brightcove.module',
    +  'name' => 'video_embed_brightcove',
    +  'type' => 'module',
    +  'owner' => '',
    +  'status' => '0',
    +  'bootstrap' => '0',
    +  'schema_version' => '-1',
    +  'weight' => '0',
    +  'info' => 'a:13:{s:4:"name";s:22:"Video Embed Brightcove";s:11:"description";s:51:"Provides Brightcove handler for Video Embed Fields.";s:4:"core";s:3:"7.x";s:7:"package";s:5:"Media";s:9:"configure";s:35:"admin/config/media/vef_video_styles";s:12:"dependencies";a:1:{i:0;s:17:"video_embed_field";}s:7:"version";s:14:"7.x-2.0-beta11";s:7:"project";s:17:"video_embed_field";s:9:"datestamp";s:10:"1441639440";s:5:"mtime";i:1441639440;s:3:"php";s:5:"5.2.4";s:5:"files";a:0:{}s:9:"bootstrap";i:0;}',
    +))
    

    The entry of video_embed_field module is missing from the database fixture's system table. Could you please add it?

  4. +++ b/tests/src/Kernel/VideoEmbedFieldTest.php
    @@ -0,0 +1,87 @@
    +      'd7_field',
    +      'd7_view_modes',
    +      'd7_node_type',
    +      'd7_comment_type',
    +      'd7_field_instance',
    +      'd7_user_role',
    +      'd7_user',
    +      'd7_node_complete',
    ...
    +    $media_entities = Media::loadMultiple();
    +    $this->assertCount(2, $media_entities);
    

    The video embed field migration isn't executed - so all the migrated media entities are stub entities.

  5. +++ b/tests/src/Kernel/VideoEmbedFieldTest.php
    @@ -0,0 +1,87 @@
    +    $this->assertEmpty($this->migrateMessages);
    

    Could you please move this assertion right after the ::executeMigrations() invocation?

  6. We should also check all the migrated media entities:
    $media_props_to_ignore = [
      'uuid',
      'revision_created',
      'thumbnail',
      'created',
      'changed',
    ];
    
    $this->assertEquals(
      [
        'mid' => [['value' => '1']],
        'vid' => [['value' => '1']],
        'langcode' => [['value' => 'en']],
        'bundle' => [['target_id' => 'remote_video']],
        'revision_user' => [],
        'revision_log_message' => [],
        'status' => [['value' => '1']],
        'uid' => [['target_id' => '0']],
        'name' => [['value' => 'https://vimeo.com/632060933']],
        'default_langcode' => [['value' => '1']],
        'revision_default' => [['value' => '1']],
        'revision_translation_affected' => [['value' => '1']],
        'field_media_oembed_video' => [
          [
            'value' => 'https://vimeo.com/632060933',
          ],
        ],
      ],
      array_diff_key(
        $media_entities[1]->toArray(),
        array_combine($media_props_to_ignore, $media_props_to_ignore)
      )
    );
    
yash.rode’s picture

Status: Needs work » Needs review
StatusFileSize
new71.91 KB
new3.95 KB

follow up for #12.

huzooka’s picture

Status: Needs review » Needs work

@yash.rode, #12.4 is still unaddressed.

yash.rode’s picture

Status: Needs work » Needs review
StatusFileSize
new71.94 KB
new1.56 KB

Sorry, I missed #14 previously.

huzooka’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new1.12 KB

@yash.rode, thanks!

  • huzooka committed 7ac800e on 8.x-1.x authored by yash.rode
    Issue #3273427 by yash.rode, huzooka: Migrate Video Embed Field from D7...
huzooka’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.