MigrateTermNodeRevisionTest.php

Same filename and directory in other branches
  1. 9 core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeRevisionTest.php
  2. 8.9.x core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeRevisionTest.php
  3. 10 core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeRevisionTest.php

Namespace

Drupal\Tests\taxonomy\Kernel\Migrate\d6

File

core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeRevisionTest.php

View source
<?php

declare (strict_types=1);
namespace Drupal\Tests\taxonomy\Kernel\Migrate\d6;

use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;

/**
 * Upgrade taxonomy term node associations.
 *
 * @group migrate_drupal_6
 */
class MigrateTermNodeRevisionTest extends MigrateDrupal6TestBase {
  
  /**
   * {@inheritdoc}
   */
  protected static $modules = [
    'taxonomy',
    'menu_ui',
  ];
  
  /**
   * {@inheritdoc}
   */
  protected function setUp() : void {
    parent::setUp();
    $this->installSchema('node', [
      'node_access',
    ]);
    $this->migrateContent([
      'revisions',
    ]);
    $this->migrateTaxonomy();
    $this->executeMigrations([
      'd6_term_node',
      'd6_term_node_revision',
    ]);
  }
  
  /**
   * Tests the Drupal 6 term-node revision association to Drupal 8 migration.
   */
  public function testTermRevisionNode() : void {
    $node = \Drupal::entityTypeManager()->getStorage('node')
      ->loadRevision(2001);
    $this->assertCount(2, $node->field_vocabulary_3_i_2_);
    $this->assertSame('4', $node->field_vocabulary_3_i_2_[0]->target_id);
    $this->assertSame('5', $node->field_vocabulary_3_i_2_[1]->target_id);
  }

}

Classes

Title Deprecated Summary
MigrateTermNodeRevisionTest Upgrade taxonomy term node associations.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.