You are here

function PaymentStatusFormTest::testCreate in Payment 8.2

@covers ::create @covers ::__construct

File

tests/src/Unit/Entity/PaymentStatus/PaymentStatusFormTest.php, line 111

Class

PaymentStatusFormTest
@coversDefaultClass \Drupal\payment\Entity\PaymentStatus\PaymentStatusForm

Namespace

Drupal\Tests\payment\Unit\Entity\PaymentStatus

Code

function testCreate() {
  $entity_type_manager = $this
    ->createMock(EntityTypeManagerInterface::class);
  $entity_type_manager
    ->expects($this
    ->any())
    ->method('getStorage')
    ->with('payment_status')
    ->willReturn($this->paymentStatusStorage);
  $plugin_type_manager = $this
    ->prophesize(PluginTypeManagerInterface::class);
  $plugin_type_manager
    ->getPluginType('payment_status')
    ->willReturn($this->paymentStatusPluginType);
  $container = $this
    ->createMock(ContainerInterface::class);
  $map = array(
    array(
      'entity_type.manager',
      ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
      $entity_type_manager,
    ),
    array(
      'plugin.manager.plugin.plugin_selector',
      ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
      $this->pluginSelectorManager,
    ),
    array(
      'plugin.plugin_type_manager',
      ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
      $plugin_type_manager
        ->reveal(),
    ),
    array(
      'string_translation',
      ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
      $this->stringTranslation,
    ),
  );
  $container
    ->expects($this
    ->any())
    ->method('get')
    ->willReturnMap($map);
  $form = PaymentStatusForm::create($container);
  $this
    ->assertInstanceOf(PaymentStatusForm::class, $form);
}