Commit 9273076d authored by alexpott's avatar alexpott

Issue #2991710 by jcnventura, maxocub, heddn, quietone, phenaproxima,...

Issue #2991710 by jcnventura, maxocub, heddn, quietone, phenaproxima, effulgentsia: Migrate system broken if content_translation enabled
parent 953b7c73
...@@ -5,6 +5,9 @@ migration_tags: ...@@ -5,6 +5,9 @@ migration_tags:
- Multilingual - Multilingual
- Follow-up migration - Follow-up migration
deriver: Drupal\migrate_drupal\Plugin\migrate\EntityReferenceTranslationDeriver deriver: Drupal\migrate_drupal\Plugin\migrate\EntityReferenceTranslationDeriver
provider:
- content_translation
- migrate_drupal
# Supported target types for entity reference translation migrations. The array # Supported target types for entity reference translation migrations. The array
# keys are the supported target types and the values are arrays of migrations # keys are the supported target types and the values are arrays of migrations
# to lookup for the translated entity IDs. # to lookup for the translated entity IDs.
......
...@@ -5,6 +5,9 @@ migration_tags: ...@@ -5,6 +5,9 @@ migration_tags:
- Multilingual - Multilingual
- Follow-up migration - Follow-up migration
deriver: Drupal\migrate_drupal\Plugin\migrate\EntityReferenceTranslationDeriver deriver: Drupal\migrate_drupal\Plugin\migrate\EntityReferenceTranslationDeriver
provider:
- content_translation
- migrate_drupal
# Supported target types for entity reference translation migrations. The array # Supported target types for entity reference translation migrations. The array
# keys are the supported target types and the values are arrays of migrations # keys are the supported target types and the values are arrays of migrations
# to lookup for the translated entity IDs. # to lookup for the translated entity IDs.
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace Drupal\Tests\migrate\Kernel\Plugin; namespace Drupal\Tests\migrate\Kernel\Plugin;
use Drupal\Core\Database\Database; use Drupal\Core\Database\Database;
use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
use Drupal\KernelTests\KernelTestBase; use Drupal\KernelTests\KernelTestBase;
use Drupal\migrate\Exception\RequirementsException; use Drupal\migrate\Exception\RequirementsException;
use Drupal\migrate\Plugin\migrate\source\SqlBase; use Drupal\migrate\Plugin\migrate\source\SqlBase;
...@@ -16,6 +17,8 @@ ...@@ -16,6 +17,8 @@
*/ */
class MigrationPluginListTest extends KernelTestBase { class MigrationPluginListTest extends KernelTestBase {
use EntityReferenceTestTrait;
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
...@@ -30,6 +33,7 @@ class MigrationPluginListTest extends KernelTestBase { ...@@ -30,6 +33,7 @@ class MigrationPluginListTest extends KernelTestBase {
'book', 'book',
'comment', 'comment',
'contact', 'contact',
'content_translation',
'dblog', 'dblog',
'field', 'field',
'file', 'file',
...@@ -60,6 +64,11 @@ class MigrationPluginListTest extends KernelTestBase { ...@@ -60,6 +64,11 @@ class MigrationPluginListTest extends KernelTestBase {
* @covers ::getDefinitions * @covers ::getDefinitions
*/ */
public function testGetDefinitions() { 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 // Make sure retrieving all the core migration plugins does not throw any
// errors. // errors.
$migration_plugins = $this->container->get('plugin.manager.migration')->getDefinitions(); $migration_plugins = $this->container->get('plugin.manager.migration')->getDefinitions();
...@@ -132,6 +141,11 @@ public function testGetDefinitions() { ...@@ -132,6 +141,11 @@ public function testGetDefinitions() {
$migration_plugins = $this->container->get('plugin.manager.migration')->getDefinitions(); $migration_plugins = $this->container->get('plugin.manager.migration')->getDefinitions();
// All the plugins provided by core depend on migrate_drupal. // All the plugins provided by core depend on migrate_drupal.
$this->assertNotEmpty($migration_plugins); $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);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment