You are here

public function MergeTermsTest::setsLocalStorage in Term Merge 8

Tests merge terms are saved to the temp store.

@test

File

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

Class

MergeTermsTest
Tests the term merge form.

Namespace

Drupal\Tests\term_merge\Kernel\Form

Code

public function setsLocalStorage() {
  $vocabulary = $this
    ->createVocabulary();
  $sut = $this
    ->createSubjectUnderTest();
  $formState = new FormState();
  $expectedTermIds = [
    1,
    2,
  ];
  $formState
    ->setValue('terms', $expectedTermIds);
  $form = $sut
    ->buildForm([], $formState, $vocabulary);
  self::assertEmpty($this->privateTempStoreFactory
    ->get('term_merge')
    ->get('terms'));
  $sut
    ->submitForm($form, $formState);
  self::assertEquals($expectedTermIds, $this->privateTempStoreFactory
    ->get('term_merge')
    ->get('terms'));
}