You are here

function PaymentMethodConfigurationBaseTest::testCreate in Payment 8.2

@covers ::create @covers ::__construct

File

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

Class

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

Namespace

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

Code

function testCreate() {
  $container = $this
    ->createMock(ContainerInterface::class);
  $map = array(
    array(
      'module_handler',
      ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
      $this->moduleHandler,
    ),
    array(
      'string_translation',
      ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
      $this->stringTranslation,
    ),
  );
  $container
    ->expects($this
    ->any())
    ->method('get')
    ->willReturnMap($map);

  /** @var \Drupal\payment\Plugin\Payment\Method\PaymentMethodBase $class_name */
  $class_name = get_class($this->sut);
  $sut = $class_name::create($container, [], '', []);
  $this
    ->assertInstanceOf(PaymentMethodConfigurationBase::class, $sut);
}