public function PaymentReferenceConfigurationFormTest::testSubmitForm in Payment 8.2
@covers ::submitForm @covers ::getPluginSelector
File
- modules/
payment_reference/ tests/ src/ Unit/ Plugin/ Payment/ Type/ PaymentReferenceConfigurationFormTest.php, line 224
Class
- PaymentReferenceConfigurationFormTest
- @coversDefaultClass \Drupal\payment_reference\Plugin\Payment\Type\PaymentReferenceConfigurationForm
Namespace
Drupal\Tests\payment_reference\Unit\Plugin\Payment\TypeCode
public function testSubmitForm() {
$form = [
'plugin_selector' => [
'foo' => $this
->randomMachineName(),
],
];
$form_state = new FormState();
$form_state
->setValues([
'plugin_selector_id' => $this->configFactoryConfiguration['payment_reference.payment_type']['plugin_selector_id'],
'allowed_plugin_ids' => $this->configFactoryConfiguration['payment_reference.payment_type']['allowed_plugin_ids'],
'limit_allowed_plugins' => $this->configFactoryConfiguration['payment_reference.payment_type']['limit_allowed_plugins'],
]);
$map = [
[
'payment_radios',
[],
$this->pluginSelector,
],
[
$this->configFactoryConfiguration['payment_reference.payment_type']['plugin_selector_id'],
[],
$this->selectedPluginSelector,
],
];
$this->pluginSelectorManager
->expects($this
->atLeast(count($map)))
->method('createInstance')
->willReturnMap($map);
$this->pluginSelector
->expects($this
->once())
->method('submitSelectorForm')
->with($form['plugin_selector'], $form_state);
$this->pluginSelector
->expects($this
->once())
->method('getSelectedPlugin')
->willReturn($this->selectedPluginSelector);
$this->sut
->submitForm($form, $form_state);
}