MigrateTermNodeTranslationTest.php in Drupal 10
File
core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeTranslationTest.php
View source
<?php
namespace Drupal\Tests\taxonomy\Kernel\Migrate\d6;
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
use Drupal\node\Entity\Node;
class MigrateTermNodeTranslationTest extends MigrateDrupal6TestBase {
protected static $modules = [
'config_translation',
'content_translation',
'language',
'locale',
'menu_ui',
'taxonomy',
];
protected function setUp() : void {
parent::setUp();
$this
->installEntitySchema('node');
$this
->installConfig([
'node',
]);
$this
->installSchema('node', [
'node_access',
]);
$this
->installSchema('system', [
'sequences',
]);
$this
->executeMigration('language');
$this
->executeMigration('d6_node_settings');
$this
->migrateUsers(FALSE);
$this
->migrateFields();
$this
->migrateTaxonomy();
$this
->migrateContent([
'translations',
]);
$this
->executeMigrations([
'd6_term_node',
'd6_term_node_translation',
]);
}
public function testTermNode() {
$this->container
->get('entity_type.manager')
->getStorage('node')
->resetCache([
18,
21,
]);
$node = Node::load(18);
$this
->assertSame('15', $node->field_vocabulary_name_much_longe[0]->target_id);
$this
->assertSame('5', $node->field_vocabulary_3_i_2_[0]->target_id);
$node = Node::load(21);
$this
->assertSame('15', $node->field_vocabulary_name_much_longe[0]->target_id);
$this
->assertSame('4', $node->field_vocabulary_3_i_2_[0]->target_id);
$translation = $node
->getTranslation('fr');
$this
->assertSame('14', $translation->field_vocabulary_name_much_longe[0]->target_id);
$this
->assertSame('9', $translation->field_vocabulary_3_i_2_[0]->target_id);
}
}