You are here

public function MergeTermsTest::vocabularyWithTerms in Term Merge 8

Tests a term merge form for a vocabulary with terms.

@test

File

tests/src/Kernel/Form/MergeTermsTest.php, line 49

Class

MergeTermsTest
Tests the term merge form.

Namespace

Drupal\Tests\term_merge\Kernel\Form

Code

public function vocabularyWithTerms() {
  $vocabulary = $this
    ->createVocabulary();
  $term1 = $this
    ->createTerm($vocabulary);
  $term2 = $this
    ->createTerm($vocabulary);
  $sut = $this
    ->createSubjectUnderTest();
  $actual = $sut
    ->buildForm([], new FormState(), $vocabulary);
  $expected = $this
    ->getEmptyFormExpectation();
  $expected['terms']['#options'][$term1
    ->id()] = $term1
    ->label();
  $expected['terms']['#options'][$term2
    ->id()] = $term2
    ->label();
  self::assertEquals($expected, $actual);
}