public function MergeTermsConfirmTest::submitFormInvokesCorrectTermMergerMethod in Term Merge 8
Tests the correct method is invoked on the term merger after confirmation.
@test @dataProvider termMergerMethodProvider
File
- tests/
src/ Kernel/ Form/ MergeTermsConfirmTest.php, line 235
Class
- MergeTermsConfirmTest
- Tests the Merge terms confirm form.
Namespace
Drupal\Tests\term_merge\Kernel\FormCode
public function submitFormInvokesCorrectTermMergerMethod($methodName, $target) {
$termMergerSpy = new TermMergerSpy();
\Drupal::getContainer()
->set('term_merge.term_merger', $termMergerSpy);
$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);
self::assertEquals([
$methodName,
], $termMergerSpy
->calledFunctions());
}