function PaymentReferenceTest::testCreate in Payment 8.2
Same name in this branch
- 8.2 modules/payment_reference/tests/src/Unit/Element/PaymentReferenceTest.php \Drupal\Tests\payment_reference\Unit\Element\PaymentReferenceTest::testCreate()
- 8.2 modules/payment_reference/tests/src/Unit/Plugin/Payment/Type/PaymentReferenceTest.php \Drupal\Tests\payment_reference\Unit\Plugin\Payment\Type\PaymentReferenceTest::testCreate()
- 8.2 modules/payment_reference/tests/src/Unit/Plugin/Field/FieldWidget/PaymentReferenceTest.php \Drupal\Tests\payment_reference\Unit\Plugin\Field\FieldWidget\PaymentReferenceTest::testCreate()
@covers ::create @covers ::__construct
File
- modules/
payment_reference/ tests/ src/ Unit/ Element/ PaymentReferenceTest.php, line 164
Class
- PaymentReferenceTest
- @coversDefaultClass \Drupal\payment_reference\Element\PaymentReference
Namespace
Drupal\Tests\payment_reference\Unit\ElementCode
function testCreate() {
$entity_type_manager = $this
->createMock(EntityTypeManagerInterface::class);
$entity_type_manager
->expects($this
->once())
->method('getStorage')
->with('payment')
->willReturn($this->paymentStorage);
$plugin_type_manager = $this
->prophesize(PluginTypeManagerInterface::class);
$plugin_type_manager
->getPluginType('payment_method')
->willReturn($this->paymentMethodType
->reveal());
$container = $this
->createMock(ContainerInterface::class);
$map = array(
array(
'current_user',
ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
$this->currentUser,
),
array(
'date.formatter',
ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
$this->dateFormatter,
),
array(
'entity_type.manager',
ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
$entity_type_manager,
),
array(
'link_generator',
ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
$this->linkGenerator,
),
array(
'payment_reference.queue',
ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
$this->paymentQueue,
),
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(
'renderer',
ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
$this->renderer,
),
array(
'request_stack',
ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
$this->requestStack,
),
array(
'string_translation',
ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
$this->stringTranslation,
),
);
$container
->expects($this
->any())
->method('get')
->willReturnMap($map);
$configuration = [];
$plugin_id = $this
->randomMachineName();
$plugin_definition = [];
$sut = PaymentReference::create($container, $configuration, $plugin_id, $plugin_definition);
$this
->assertInstanceOf(PaymentReference::class, $sut);
}