public function ReferenceMigratorTest::regression3014387 in Term reference change 8
Test that merging referenced A and B into unreferenced C is without dupes.
@test
File
- tests/
src/ Kernel/ ReferenceMigratorTest.php, line 183
Class
- ReferenceMigratorTest
- Tests that references are migrated.
Namespace
Drupal\Tests\term_reference_change\KernelCode
public function regression3014387() {
$a = $this
->createTerm($this->vocabulary);
$b = $this
->createTerm($this->vocabulary);
$c = $this
->createTerm($this->vocabulary);
$node1 = $this
->createNode([
'field_terms' => [
[
'target_id' => $a
->id(),
],
[
'target_id' => $b
->id(),
],
],
]);
$this
->assertNodeReferencesTermOnce($node1, $a);
$this
->assertNodeReferencesTermOnce($node1, $b);
$sut = new ReferenceMigrator(\Drupal::service('term_reference_change.reference_finder'));
$sut
->migrateReference($a, $c);
$sut
->migrateReference($b, $c);
$this
->assertNodeReferencesTermOnce($node1, $c);
}