Unverified Commit a4629b22 authored by alexpott's avatar alexpott
Browse files

Issue #3184184 by quietone, Wim Leers, marvil07: Test that the...

Issue #3184184 by quietone, Wim Leers, marvil07: Test that the d7_entity_reference_translation follow-up migration runs not just for node entities
parent 92a87eac
......@@ -8654,6 +8654,16 @@
'delta' => '0',
'field_reference_target_id' => '2',
))
->values(array(
'entity_type' => 'user',
'bundle' => 'user',
'deleted' => '0',
'entity_id' => '2',
'revision_id' => '2',
'language' => 'und',
'delta' => '0',
'field_reference_target_id' => '3',
))
->execute();
$connection->schema()->createTable('field_data_field_reference_2', array(
'fields' => array(
......@@ -15243,6 +15253,16 @@
'delta' => '0',
'field_reference_target_id' => '2',
))
->values(array(
'entity_type' => 'user',
'bundle' => 'user',
'deleted' => '0',
'entity_id' => '2',
'revision_id' => '2',
'language' => 'und',
'delta' => '0',
'field_reference_target_id' => '3',
))
->execute();
$connection->schema()->createTable('field_revision_field_reference_2', array(
'fields' => array(
......@@ -4,6 +4,7 @@
use Drupal\node\Entity\Node;
use Drupal\Tests\file\Kernel\Migrate\d7\FileMigrationSetupTrait;
use Drupal\user\Entity\User;
/**
* Tests follow-up migrations.
......@@ -44,8 +45,8 @@ protected function setUp(): void {
$this->installEntitySchema('comment');
$this->installSchema('node', ['node_access']);
$this->migrateUsers();
$this->migrateFields();
$this->migrateUsers();
$this->executeMigrations([
'language',
'd7_language_content_settings',
......@@ -86,6 +87,9 @@ public function testEntityReferenceTranslations() {
$this->assertSame('2', $translation->get('field_reference')->target_id);
$this->assertSame('2', $translation->get('field_reference_2')->target_id);
$user = User::load(2);
$this->assertSame('3', $user->get('field_reference')->target_id);
// Run the follow-up migrations.
$migration_plugin_manager = $this->container->get('plugin.manager.migration');
$migration_plugin_manager->clearCachedDefinitions();
......@@ -106,6 +110,9 @@ public function testEntityReferenceTranslations() {
$translation = $node->getTranslation('en');
$this->assertSame('2', $translation->get('field_reference')->target_id);
$this->assertSame('2', $translation->get('field_reference_2')->target_id);
$user = User::load(2);
$this->assertSame('2', $user->get('field_reference')->target_id);
}
}
......@@ -4,6 +4,7 @@
use Drupal\node\Entity\Node;
use Drupal\Tests\migrate_drupal_ui\Functional\MigrateUpgradeExecuteTestBase;
use Drupal\user\Entity\User;
// cspell:ignore Multiupload Imagefield
......@@ -248,6 +249,8 @@ protected function assertFollowUpMigrationResults() {
$this->assertSame('2', $translation->get('field_reference')->target_id);
$this->assertSame('2', $translation->get('field_reference_2')->target_id);
$user = User::load(2);
$this->assertSame('2', $user->get('field_reference')->target_id);
}
}
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