You are here

function PaymentReferenceTest::testCreate in Payment 8.2

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

@covers ::create @covers ::__construct

File

modules/payment_reference/tests/src/Unit/Plugin/Field/FieldWidget/PaymentReferenceTest.php, line 94

Class

PaymentReferenceTest
@coversDefaultClass \Drupal\payment_reference\Plugin\Field\FieldWidget\PaymentReference

Namespace

Drupal\Tests\payment_reference\Unit\Plugin\Field\FieldWidget

Code

function testCreate() {
  $container = $this
    ->createMock(ContainerInterface::class);
  $map = array(
    array(
      'config.factory',
      ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
      $this->configFactory,
    ),
    array(
      'current_user',
      ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
      $this->currentUser,
    ),
    array(
      'payment_reference.payment_factory',
      ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
      $this->paymentFactory,
    ),
  );
  $container
    ->expects($this
    ->any())
    ->method('get')
    ->willReturnMap($map);
  $configuration = array(
    'field_definition' => $this->fieldDefinition,
    'settings' => [],
    'third_party_settings' => [],
  );
  $plugin_definition = [];
  $plugin_id = $this
    ->randomMachineName();
  $sut = PaymentReference::create($container, $configuration, $plugin_id, $plugin_definition);
  $this
    ->assertInstanceOf(PaymentReference::class, $sut);
}