You are here

public function MergeTermsConfirmTest::submitRedirectsToMergeRoute in Term Merge 8

Tests the redirect after merging terms.

@test @dataProvider termMergerMethodProvider

File

tests/src/Kernel/Form/MergeTermsConfirmTest.php, line 257

Class

MergeTermsConfirmTest
Tests the Merge terms confirm form.

Namespace

Drupal\Tests\term_merge\Kernel\Form

Code

public function submitRedirectsToMergeRoute($methodName, $target) {
  $sut = $this
    ->createSubjectUnderTest();
  $terms = [
    reset($this->terms)
      ->id(),
    end($this->terms)
      ->id(),
  ];
  $this->privateTempStoreFactory
    ->get('term_merge')
    ->set('terms', $terms);
  $this->privateTempStoreFactory
    ->get('term_merge')
    ->set('target', $this
    ->prepareTarget($target));
  $formState = new FormState();
  $build = $sut
    ->buildForm([], $formState, $this->vocabulary);
  $sut
    ->submitForm($build, $formState);
  $routeName = 'entity.taxonomy_vocabulary.merge_form';
  self::assertRedirect($formState, $routeName, $this->vocabulary
    ->id());
}