public function ReferenceMigratorTest::doesNotFailWhenReferenceFieldIsEmpty in Term reference change 8
Tests term merging does not fail when the source field is empty.
@test
File
- tests/
src/ Kernel/ ReferenceMigratorTest.php, line 137
Class
- ReferenceMigratorTest
- Tests that references are migrated.
Namespace
Drupal\Tests\term_reference_change\KernelCode
public function doesNotFailWhenReferenceFieldIsEmpty() {
$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);
}