public function MergeTermsConfirmTest::submitSetsSuccessMessage in Term Merge 8
Tests a status message is displayed after merging terms.
@test
File
- tests/
src/ Kernel/ Form/ MergeTermsConfirmTest.php, line 277
Class
- MergeTermsConfirmTest
- Tests the Merge terms confirm form.
Namespace
Drupal\Tests\term_merge\Kernel\FormCode
public function submitSetsSuccessMessage() {
$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', 'Target');
$formState = new FormState();
$build = $sut
->buildForm([], $formState, $this->vocabulary);
$sut
->submitForm($build, $formState);
$arguments = [
'%count' => 2,
'%target' => 'Target',
];
$expected = [
new TranslatableMarkup('Successfully merged %count terms into %target', $arguments),
];
self::assertEquals($expected, \Drupal::messenger()
->messagesByType('status'));
}