You are here

function SelectPaymentMethodConfigurationTest::testCreate in Payment 8.2

@covers ::create @covers ::__construct

File

tests/src/Unit/Controller/SelectPaymentMethodConfigurationTest.php, line 66

Class

SelectPaymentMethodConfigurationTest
@coversDefaultClass \Drupal\payment\Controller\SelectPaymentMethodConfiguration

Namespace

Drupal\Tests\payment\Unit\Controller

Code

function testCreate() {
  $entity_type_manager = $this
    ->createMock(EntityTypeManagerInterface::class);
  $entity_type_manager
    ->expects($this
    ->atLeastOnce())
    ->method('getAccessControlHandler')
    ->with('payment_method_configuration')
    ->willReturn($this->paymentMethodConfigurationAccessControlHandler);
  $container = $this
    ->createMock(ContainerInterface::class);
  $map = [
    [
      'current_user',
      ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
      $this->currentUser,
    ],
    [
      'entity_type.manager',
      ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
      $entity_type_manager,
    ],
    [
      'plugin.manager.payment.method_configuration',
      ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
      $this->paymentMethodConfigurationManager,
    ],
  ];
  $container
    ->expects($this
    ->any())
    ->method('get')
    ->willReturnMap($map);
  $sut = SelectPaymentMethodConfiguration::create($container);
  $this
    ->assertInstanceOf(SelectPaymentMethodConfiguration::class, $sut);
}