summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2018-08-10 21:29:14 (GMT)
committerAlex Pott2018-08-10 21:29:29 (GMT)
commit596caa3e51751a091587ed7784944fa183179494 (patch)
treec9284c09791014a653a80be7629bcb154ae7ec40
parentdef290c1fe41805a419e006bb120db85755201e3 (diff)
Issue #2991710 by jcnventura, maxocub, heddn, quietone, phenaproxima, effulgentsia: Migrate system broken if content_translation enabled
(cherry picked from commit 9273076d01e7c65c8e7ee8337cc904e09a226dd3)
-rw-r--r--core/modules/content_translation/migrations/d6_entity_reference_translation.yml3
-rw-r--r--core/modules/content_translation/migrations/d7_entity_reference_translation.yml3
-rw-r--r--core/modules/migrate/tests/src/Kernel/Plugin/MigrationPluginListTest.php14
3 files changed, 20 insertions, 0 deletions
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 74a586b..87150ec 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 af5bef9..2e8d548 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 3a3487f..7bfba70 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 @@ use Drupal\migrate\Plugin\RequirementsInterface;
*/
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 @@ class MigrationPluginListTest extends KernelTestBase {
$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);
}
}