You are here

function PaymentMethodConfigurationFormTest::testCreate in Payment 8.2

@covers ::create @covers ::__construct

File

tests/src/Unit/Entity/PaymentMethodConfiguration/PaymentMethodConfigurationFormTest.php, line 118

Class

PaymentMethodConfigurationFormTest
@coversDefaultClass \Drupal\payment\Entity\PaymentMethodConfiguration\PaymentMethodConfigurationForm

Namespace

Drupal\Tests\payment\Unit\Entity\PaymentMethodConfiguration

Code

function testCreate() {
  $entity_type_manager = $this
    ->createMock(EntityTypeManagerInterface::class);
  $map = array(
    array(
      'payment_method_configuration',
      $this->paymentMethodConfigurationStorage,
    ),
  );
  $entity_type_manager
    ->expects($this
    ->atLeast(count($map)))
    ->method('getStorage')
    ->willReturnMap($map);
  $container = $this
    ->createMock(ContainerInterface::class);
  $map = array(
    array(
      'current_user',
      ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
      $this->currentUser,
    ),
    array(
      'entity_type.manager',
      ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
      $entity_type_manager,
    ),
    array(
      'plugin.manager.payment.method_configuration',
      ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
      $this->paymentMethodConfigurationManager,
    ),
    array(
      'string_translation',
      ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
      $this->stringTranslation,
    ),
  );
  $container
    ->expects($this
    ->any())
    ->method('get')
    ->willReturnMap($map);
  $form = PaymentMethodConfigurationForm::create($container);
  $this
    ->assertInstanceOf(PaymentMethodConfigurationForm::class, $form);
}