You are here

public function MigrateTermNodeTest::testSkipNonExistentNode in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeTest.php \Drupal\Tests\taxonomy\Kernel\Migrate\d6\MigrateTermNodeTest::testSkipNonExistentNode()
  2. 9 core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeTest.php \Drupal\Tests\taxonomy\Kernel\Migrate\d6\MigrateTermNodeTest::testSkipNonExistentNode()

Tests that term associations are ignored when they belong to nodes which were not migrated.

File

core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeTest.php, line 55

Class

MigrateTermNodeTest
Upgrade taxonomy term node associations.

Namespace

Drupal\Tests\taxonomy\Kernel\Migrate\d6

Code

public function testSkipNonExistentNode() {

  // Node 2 is migrated by d6_node__story, but we need to pretend that it
  // failed, so record that in the map table.
  $this
    ->mockFailure('d6_node:story', [
    'nid' => 2,
    'language' => 'en',
  ]);

  // d6_term_node__2 should skip over node 2 (a.k.a. revision 3) because,
  // according to the map table, it failed.
  $migration = $this
    ->getMigration('d6_term_node:2');
  $this
    ->executeMigration($migration);
  $this
    ->assertNull($migration
    ->getIdMap()
    ->lookupDestinationIds([
    'vid' => 3,
  ])[0][0]);
}