You are here

function BasicTest::testCreate in Payment 8.2

Same name in this branch
  1. 8.2 tests/src/Unit/Plugin/Payment/MethodConfiguration/BasicTest.php \Drupal\Tests\payment\Unit\Plugin\Payment\MethodConfiguration\BasicTest::testCreate()
  2. 8.2 tests/src/Unit/Plugin/Payment/Method/BasicTest.php \Drupal\Tests\payment\Unit\Plugin\Payment\Method\BasicTest::testCreate()
  3. 8.2 tests/src/Unit/Plugin/Payment/LineItem/BasicTest.php \Drupal\Tests\payment\Unit\Plugin\Payment\LineItem\BasicTest::testCreate()

@covers ::create @covers ::__construct

File

tests/src/Unit/Plugin/Payment/MethodConfiguration/BasicTest.php, line 72

Class

BasicTest
@coversDefaultClass \Drupal\payment\Plugin\Payment\MethodConfiguration\Basic

Namespace

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

Code

function testCreate() {
  $plugin_type_manager = $this
    ->prophesize(PluginTypeManagerInterface::class);
  $plugin_type_manager
    ->getPluginType('payment_status')
    ->willReturn($this->paymentStatusType
    ->reveal());
  $container = $this
    ->createMock(ContainerInterface::class);
  $map = array(
    array(
      'module_handler',
      ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
      $this->moduleHandler,
    ),
    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);
  $configuration = [];
  $plugin_definition = [];
  $plugin_id = $this
    ->randomMachineName();
  $sut = Basic::create($container, $configuration, $plugin_id, $plugin_definition);
  $this
    ->assertInstanceOf(Basic::class, $sut);
}