You are here

public function PaymentTypeBaseTest::testCreate in Payment 8.2

@covers ::create @covers ::__construct

File

tests/src/Unit/Plugin/Payment/Type/PaymentTypeBaseTest.php, line 51

Class

PaymentTypeBaseTest
@coversDefaultClass \Drupal\payment\Plugin\Payment\Type\PaymentTypeBase

Namespace

Drupal\Tests\payment\Unit\Plugin\Payment\Type

Code

public function testCreate() {
  $container = $this
    ->createMock(ContainerInterface::class);
  $map = [
    [
      'payment.event_dispatcher',
      ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
      $this->eventDispatcher,
    ],
  ];
  $container
    ->expects($this
    ->any())
    ->method('get')
    ->willReturnMap($map);

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