public function PaymentMethodConfigurationFormTest::testValidateForm in Payment 8.2
@covers ::validateForm
File
- tests/
src/ Unit/ Entity/ PaymentMethodConfiguration/ PaymentMethodConfigurationFormTest.php, line 383
Class
- PaymentMethodConfigurationFormTest
- @coversDefaultClass \Drupal\payment\Entity\PaymentMethodConfiguration\PaymentMethodConfigurationForm
Namespace
Drupal\Tests\payment\Unit\Entity\PaymentMethodConfigurationCode
public function testValidateForm() {
/** @var \Drupal\payment\Entity\PaymentMethodConfiguration\PaymentMethodConfigurationForm|\PHPUnit\Framework\MockObject\MockObject $form_object */
$this->sut = $this
->getMockBuilder(PaymentMethodConfigurationForm::class)
->setConstructorArgs(array(
$this->stringTranslation,
$this->currentUser,
$this->paymentMethodConfigurationStorage,
$this->paymentMethodConfigurationManager,
))
->setMethods(array(
'copyFormValuesToEntity',
))
->getMock();
$this->sut
->setEntity($this->paymentMethodConfiguration);
$payment_method_configuration_plugin = $this
->createMock(PaymentMethodConfigurationInterfacePlugin::class);
$form = array(
'plugin_form' => array(
'#type' => $this
->randomMachineName(),
),
);
$form_state = $this
->createMock(FormStateInterface::class);
$map = array(
array(
'payment_method_configuration',
$payment_method_configuration_plugin,
),
);
$form_state
->expects($this
->any())
->method('get')
->willReturnMap($map);
$payment_method_configuration_plugin
->expects($this
->once())
->method('validateConfigurationForm')
->with($form['plugin_form'], $form_state);
$this->sut
->validateForm($form, $form_state);
}