You are here

public function MergeTermsConfirmTest::incorrectTargetThrowsException in Term Merge 8

Tests an exception is thrown for for invalid target types.

File

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

Class

MergeTermsConfirmTest
Tests the Merge terms confirm form.

Namespace

Drupal\Tests\term_merge\Kernel\Form

Code

public function incorrectTargetThrowsException() {
  $this
    ->expectException('\\LogicException', 'Invalid target type. Should be string or implement TermInterface');
  $sut = $this
    ->createSubjectUnderTest();
  $this->privateTempStoreFactory
    ->get('term_merge')
    ->set('terms', [
    1,
    2,
  ]);
  $this->privateTempStoreFactory
    ->get('term_merge')
    ->set('target', (object) []);
  $formState = new FormState();
  $build = $sut
    ->buildForm([], $formState, $this->vocabulary);
  $sut
    ->submitForm($build, $formState);
}