You are here

public function PaymentMethodConfigurationBaseTest::testBuildConfigurationFormWithoutFilter in Payment 8.2

@covers ::buildConfigurationForm

File

tests/src/Unit/Plugin/Payment/MethodConfiguration/PaymentMethodConfigurationBaseTest.php, line 103

Class

PaymentMethodConfigurationBaseTest
@coversDefaultClass \Drupal\payment\Plugin\Payment\MethodConfiguration\PaymentMethodConfigurationBase

Namespace

Drupal\Tests\payment\Unit\Plugin\Payment\MethodConfiguration

Code

public function testBuildConfigurationFormWithoutFilter() {
  $form = [];
  $form_state = $this
    ->createMock(FormStateInterface::class);
  $this->moduleHandler
    ->expects($this
    ->once())
    ->method('moduleExists')
    ->with('filter')
    ->willReturn(FALSE);
  $message_text = $this
    ->randomMachineName();
  $this->sut
    ->setMessageText($message_text);
  $build = $this->sut
    ->buildConfigurationForm($form, $form_state);
  $expected_build = array(
    'message' => array(
      '#tree' => TRUE,
      '#type' => 'textarea',
      '#title' => 'Payment form message',
      '#default_value' => $message_text,
    ),
  );
  $this
    ->assertEquals($expected_build, $build);
}