You are here

public function PaymentReferenceConfigurationFormTest::testBuildForm in Payment 8.2

@covers ::buildForm @covers ::getPluginSelector

File

modules/payment_reference/tests/src/Unit/Plugin/Payment/Type/PaymentReferenceConfigurationFormTest.php, line 163

Class

PaymentReferenceConfigurationFormTest
@coversDefaultClass \Drupal\payment_reference\Plugin\Payment\Type\PaymentReferenceConfigurationForm

Namespace

Drupal\Tests\payment_reference\Unit\Plugin\Payment\Type

Code

public function testBuildForm() {
  $form = [];
  $form_state = new FormState();
  $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('buildSelectorForm')
    ->with([], $form_state)
    ->willReturn($this->pluginSelector);
  $this->paymentMethodManager
    ->expects($this
    ->atLeastOnce())
    ->method('getDefinitions')
    ->willReturn([]);
  $build = $this->sut
    ->buildForm($form, $form_state);
  $this
    ->assertIsArray($build);
}