You are here

public function PaymentStatusBaseTest::testCreate in Payment 8.2

@covers ::create @covers ::__construct

File

tests/src/Unit/Plugin/Payment/Status/PaymentStatusBaseTest.php, line 111

Class

PaymentStatusBaseTest
@coversDefaultClass \Drupal\payment\Plugin\Payment\Status\PaymentStatusBase

Namespace

Drupal\Tests\payment\Unit\Plugin\Payment\Status

Code

public function testCreate() {
  $container = $this
    ->createMock(ContainerInterface::class);
  \Drupal::setContainer($container);
  $map = array(
    array(
      'language_manager',
      ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
      $this->languageManager,
    ),
    array(
      'module_handler',
      ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
      $this->moduleHandler,
    ),
    array(
      'plugin.manager.payment.status',
      ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
      $this->paymentStatusManager,
    ),
  );
  $container
    ->expects($this
    ->any())
    ->method('get')
    ->willReturnMap($map);

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