You are here

public function MigrateTermNodeTest::testTermNode in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/taxonomy/src/Tests/Migrate/d6/MigrateTermNodeTest.php \Drupal\taxonomy\Tests\Migrate\d6\MigrateTermNodeTest::testTermNode()

Tests the Drupal 6 term-node association to Drupal 8 migration.

File

core/modules/taxonomy/src/Tests/Migrate/d6/MigrateTermNodeTest.php, line 41
Contains \Drupal\taxonomy\Tests\Migrate\d6\MigrateTermNodeTest.

Class

MigrateTermNodeTest
Upgrade taxonomy term node associations.

Namespace

Drupal\taxonomy\Tests\Migrate\d6

Code

public function testTermNode() {
  $this
    ->executeMigrations([
    'd6_term_node:*',
  ]);
  $this->container
    ->get('entity.manager')
    ->getStorage('node')
    ->resetCache([
    1,
    2,
  ]);
  $nodes = Node::loadMultiple([
    1,
    2,
  ]);
  $node = $nodes[1];
  $this
    ->assertIdentical(1, count($node->vocabulary_1_i_0_));
  $this
    ->assertIdentical('1', $node->vocabulary_1_i_0_[0]->target_id);
  $node = $nodes[2];
  $this
    ->assertIdentical(2, count($node->vocabulary_2_i_1_));
  $this
    ->assertIdentical('2', $node->vocabulary_2_i_1_[0]->target_id);
  $this
    ->assertIdentical('3', $node->vocabulary_2_i_1_[1]->target_id);
}