You are here

public function ReferenceMigratorTest::doesNotFailWhenReferenceFieldIsMissing in Term reference change 8

Tests term merging does not fail when the target field is missing.

@test

File

tests/src/Kernel/ReferenceMigratorTest.php, line 120

Class

ReferenceMigratorTest
Tests that references are migrated.

Namespace

Drupal\Tests\term_reference_change\Kernel

Code

public function doesNotFailWhenReferenceFieldIsMissing() {
  $this
    ->setUpContentType('article', 'field_category');
  $sourceTerm = $this
    ->createTerm($this->vocabulary);
  $targetTerm = $this
    ->createTerm($this->vocabulary);
  $node1 = $this
    ->createNode([
    'field_terms' => [
      'target_id' => $sourceTerm
        ->id(),
    ],
  ]);
  $sut = new ReferenceMigrator(\Drupal::service('term_reference_change.reference_finder'));
  $sut
    ->migrateReference($sourceTerm, $targetTerm);
  $this
    ->assertNodeReferencesTermOnce($node1, $targetTerm);
}