public function BasicTest::testProcessBuildConfigurationForm in Payment 8.2
@covers ::processBuildConfigurationForm @covers ::getExecutePaymentStatusSelector @covers ::getCapturePaymentStatusSelector @covers ::getRefundPaymentStatusSelector @covers ::getPaymentStatusSelector
File
- tests/
src/ Unit/ Plugin/ Payment/ MethodConfiguration/ BasicTest.php, line 179
Class
- BasicTest
- @coversDefaultClass \Drupal\payment\Plugin\Payment\MethodConfiguration\Basic
Namespace
Drupal\Tests\payment\Unit\Plugin\Payment\MethodConfigurationCode
public function testProcessBuildConfigurationForm() {
$payment_status = $this
->createMock(PaymentStatusInterface::class);
$this->paymentStatusManager
->expects($this
->at(0))
->method('createInstance')
->with('payment_pending')
->willReturn($payment_status);
$this->paymentStatusManager
->expects($this
->at(1))
->method('createInstance')
->with('payment_success')
->willReturn($payment_status);
$this->paymentStatusManager
->expects($this
->at(2))
->method('createInstance')
->with('payment_refunded')
->willReturn($payment_status);
$payment_status_selector = $this
->createMock(PluginSelectorInterface::class);
$this->pluginSelectorManager
->expects($this
->atLeastOnce())
->method('createInstance')
->willReturn($payment_status_selector);
$element = array(
'#parents' => array(
'foo',
'bar',
),
);
$form = [];
$form_state = new FormState();
$elements = $this->sut
->processBuildConfigurationForm($element, $form_state, $form);
$this
->assertIsArray($elements);
foreach (array(
'brand_label',
'execute',
'capture',
'refund',
) as $key) {
$this
->assertArrayHasKey($key, $elements);
$this
->assertIsArray($elements[$key]);
}
}