public function MergeTermsConfirmTest::buildForm in Term Merge 8
Tests the form build for the confirm form.
@test @dataProvider selectedTermsProvider
File
- tests/
src/ Kernel/ Form/ MergeTermsConfirmTest.php, line 111
Class
- MergeTermsConfirmTest
- Tests the Merge terms confirm form.
Namespace
Drupal\Tests\term_merge\Kernel\FormCode
public function buildForm(array $selectedTerms, $target) {
$target = $this
->prepareTarget($target);
$sut = $this
->createSubjectUnderTest();
$this->privateTempStoreFactory
->get('term_merge')
->set('terms', $selectedTerms);
$this->privateTempStoreFactory
->get('term_merge')
->set('target', $target);
$actual = $sut
->buildForm([], new FormState(), $this->vocabulary);
if (empty($selectedTerms)) {
self::assertEquals([], $actual);
$this
->assertSingleErrorMessage(new TranslatableMarkup("You must submit at least one term."));
}
else {
$this
->assertConfirmationForm($selectedTerms, $actual, $target);
}
}