You are here

public function TermMergerTermCrudTest::mergeIntoTermSavesTermIfNewTermIsPassedIn in Term Merge 8

Tests a taxonomy term that is passed to the migration is saved correctly.

@test

File

tests/src/Kernel/TermMergerTermCrudTest.php, line 113

Class

TermMergerTermCrudTest
Tests term merging for taxonomy terms.

Namespace

Drupal\Tests\term_merge\Kernel

Code

public function mergeIntoTermSavesTermIfNewTermIsPassedIn() {
  $sut = $this
    ->createSubjectUnderTest();
  $values = [
    'name' => 'Unsaved term',
    'vid' => $this->vocabulary
      ->id(),
  ];

  /** @var \Drupal\taxonomy\TermInterface $term */
  $term = $this->entityTypeManager
    ->getStorage('taxonomy_term')
    ->create($values);
  self::assertEmpty($term
    ->id());
  $sut
    ->mergeIntoTerm($this->terms, $term);
  self::assertNotEmpty($term
    ->id());
}