You are here

public function MergeTermsTest::redirectsToConfirmationForm in Term Merge 8

Tests the form redirects to the confirm form.

@test

File

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

Class

MergeTermsTest
Tests the term merge form.

Namespace

Drupal\Tests\term_merge\Kernel\Form

Code

public function redirectsToConfirmationForm() {
  $vocabulary = $this
    ->createVocabulary();
  $sut = $this
    ->createSubjectUnderTest();
  $formState = new FormState();
  $formState
    ->setValue('terms', [
    1,
    2,
  ]);
  $form = $sut
    ->buildForm([], $formState, $vocabulary);
  $sut
    ->submitForm($form, $formState);
  $routeName = 'entity.taxonomy_vocabulary.merge_target';
  $routeParameters['taxonomy_vocabulary'] = $vocabulary
    ->id();
  $expected = new Url($routeName, $routeParameters);
  self::assertEquals($expected, $formState
    ->getRedirect());
}