diff --git a/core/modules/content_translation/migrations/d6_entity_reference_translation.yml b/core/modules/content_translation/migrations/d6_entity_reference_translation.yml index 74a586b82349794e0590bb7494951bc757505e14..87150ec3957b8a820333a07b29f7ec3551f49ffe 100644 --- a/core/modules/content_translation/migrations/d6_entity_reference_translation.yml +++ b/core/modules/content_translation/migrations/d6_entity_reference_translation.yml @@ -5,6 +5,9 @@ migration_tags: - Multilingual - Follow-up migration deriver: Drupal\migrate_drupal\Plugin\migrate\EntityReferenceTranslationDeriver +provider: + - content_translation + - migrate_drupal # Supported target types for entity reference translation migrations. The array # keys are the supported target types and the values are arrays of migrations # to lookup for the translated entity IDs. diff --git a/core/modules/content_translation/migrations/d7_entity_reference_translation.yml b/core/modules/content_translation/migrations/d7_entity_reference_translation.yml index af5bef9490fffd419680004838a9f034a46722b9..2e8d548f0a085b029fba6ed9ae00978b261a8c32 100644 --- a/core/modules/content_translation/migrations/d7_entity_reference_translation.yml +++ b/core/modules/content_translation/migrations/d7_entity_reference_translation.yml @@ -5,6 +5,9 @@ migration_tags: - Multilingual - Follow-up migration deriver: Drupal\migrate_drupal\Plugin\migrate\EntityReferenceTranslationDeriver +provider: + - content_translation + - migrate_drupal # Supported target types for entity reference translation migrations. The array # keys are the supported target types and the values are arrays of migrations # to lookup for the translated entity IDs. diff --git a/core/modules/migrate/tests/src/Kernel/Plugin/MigrationPluginListTest.php b/core/modules/migrate/tests/src/Kernel/Plugin/MigrationPluginListTest.php index 3a3487f69acebab7e51a5820ba98d5de2ee33953..7bfba70f27a12a92e55ce0375d3a2e0abe2a8cc6 100644 --- a/core/modules/migrate/tests/src/Kernel/Plugin/MigrationPluginListTest.php +++ b/core/modules/migrate/tests/src/Kernel/Plugin/MigrationPluginListTest.php @@ -3,6 +3,7 @@ namespace Drupal\Tests\migrate\Kernel\Plugin; use Drupal\Core\Database\Database; +use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait; use Drupal\KernelTests\KernelTestBase; use Drupal\migrate\Exception\RequirementsException; use Drupal\migrate\Plugin\migrate\source\SqlBase; @@ -16,6 +17,8 @@ */ class MigrationPluginListTest extends KernelTestBase { + use EntityReferenceTestTrait; + /** * {@inheritdoc} */ @@ -30,6 +33,7 @@ class MigrationPluginListTest extends KernelTestBase { 'book', 'comment', 'contact', + 'content_translation', 'dblog', 'field', 'file', @@ -60,6 +64,11 @@ class MigrationPluginListTest extends KernelTestBase { * @covers ::getDefinitions */ public function testGetDefinitions() { + // Create an entity reference field to make sure that migrations derived by + // EntityReferenceTranslationDeriver do not get discovered without + // migrate_drupal enabled. + $this->createEntityReferenceField('user', 'user', 'field_entity_reference', 'Entity Reference', 'node'); + // Make sure retrieving all the core migration plugins does not throw any // errors. $migration_plugins = $this->container->get('plugin.manager.migration')->getDefinitions(); @@ -132,6 +141,11 @@ public function testGetDefinitions() { $migration_plugins = $this->container->get('plugin.manager.migration')->getDefinitions(); // All the plugins provided by core depend on migrate_drupal. $this->assertNotEmpty($migration_plugins); + + // Test that migrations derived by EntityReferenceTranslationDeriver are + // discovered now that migrate_drupal is enabled. + $this->assertArrayHasKey('d6_entity_reference_translation:user__user', $migration_plugins); + $this->assertArrayHasKey('d7_entity_reference_translation:user__user', $migration_plugins); } }