You are here

function PaymentFormTest::testCreate in Payment 8.2

Same name in this branch
  1. 8.2 modules/payment_form/tests/src/Unit/Plugin/Payment/Type/PaymentFormTest.php \Drupal\Tests\payment_form\Unit\Plugin\Payment\Type\PaymentFormTest::testCreate()
  2. 8.2 modules/payment_form/tests/src/Unit/Plugin/Field/FieldFormatter/PaymentFormTest.php \Drupal\Tests\payment_form\Unit\Plugin\Field\FieldFormatter\PaymentFormTest::testCreate()
  3. 8.2 modules/payment_form/tests/src/Unit/Plugin/Field/FieldWidget/PaymentFormTest.php \Drupal\Tests\payment_form\Unit\Plugin\Field\FieldWidget\PaymentFormTest::testCreate()

@covers ::create @covers ::__construct

File

modules/payment_form/tests/src/Unit/Plugin/Field/FieldWidget/PaymentFormTest.php, line 72

Class

PaymentFormTest
@coversDefaultClass \Drupal\payment_form\Plugin\Field\FieldWidget\PaymentForm

Namespace

Drupal\Tests\payment_form\Unit\Plugin\Field\FieldWidget

Code

function testCreate() {
  $container = $this
    ->createMock(ContainerInterface::class);
  $map = [
    [
      'plugin.manager.payment.line_item',
      ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
      $this->paymentLineItemManager,
    ],
    [
      'string_translation',
      ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
      $this->stringTranslation,
    ],
  ];
  $container
    ->expects($this
    ->any())
    ->method('get')
    ->willReturnMap($map);
  $field_definition = $this
    ->createMock(FieldDefinitionInterface::class);
  $configuration = [
    'field_definition' => $field_definition,
    'settings' => [],
    'third_party_settings' => [],
  ];
  $plugin_definition = [];
  $plugin_id = $this
    ->randomMachineName();
  $sut = PaymentForm::create($container, $configuration, $plugin_id, $plugin_definition);
  $this
    ->assertInstanceOf(PaymentForm::class, $sut);
}