protected function PaymentFormTest::setUp in Payment 8.2
Same name in this branch
- 8.2 modules/payment_form/tests/src/Unit/Entity/Payment/PaymentFormTest.php \Drupal\Tests\payment_form\Unit\Entity\Payment\PaymentFormTest::setUp()
- 8.2 modules/payment_form/tests/src/Unit/Plugin/Payment/Type/PaymentFormTest.php \Drupal\Tests\payment_form\Unit\Plugin\Payment\Type\PaymentFormTest::setUp()
- 8.2 modules/payment_form/tests/src/Unit/Plugin/Field/FieldFormatter/PaymentFormTest.php \Drupal\Tests\payment_form\Unit\Plugin\Field\FieldFormatter\PaymentFormTest::setUp()
- 8.2 modules/payment_form/tests/src/Unit/Plugin/Field/FieldWidget/PaymentFormTest.php \Drupal\Tests\payment_form\Unit\Plugin\Field\FieldWidget\PaymentFormTest::setUp()
- 8.2 modules/payment_form/tests/src/Unit/Plugin/Field/FieldType/PaymentFormTest.php \Drupal\Tests\payment_form\Unit\Plugin\Field\FieldType\PaymentFormTest::setUp()
Overrides UnitTestCase::setUp
File
- modules/
payment_form/ tests/ src/ Unit/ Entity/ Payment/ PaymentFormTest.php, line 140
Class
- PaymentFormTest
- @coversDefaultClass \Drupal\payment_form\Entity\Payment\PaymentForm
Namespace
Drupal\Tests\payment_form\Unit\Entity\PaymentCode
protected function setUp() : void {
$this->currentUser = $this
->createMock(AccountInterface::class);
$this->entityRepository = $this
->createMock(EntityRepositoryInterface::class);
$this->formDisplay = $this
->createMock(EntityFormDisplayInterface::class);
$this->payment = $this
->createMock(PaymentInterface::class);
$this->paymentMethodManager = $this
->createMock(PaymentMethodManagerInterface::class);
$this->stringTranslation = $this
->getStringTranslationStub();
$this->paymentMethodType = $this
->prophesize(PluginTypeInterface::class);
$this->paymentMethodType
->getPluginManager()
->willReturn($this->paymentMethodManager);
$this->pluginSelector = $this
->createMock(PluginSelectorInterface::class);
$this->pluginSelectorManager = $this
->createMock(PluginSelectorManagerInterface::class);
$this->configFactoryConfiguration = [
'payment_form.payment_type' => [
'limit_allowed_plugins' => TRUE,
'allowed_plugin_ids' => [
$this
->randomMachineName(),
],
'plugin_selector_id' => $this
->randomMachineName(),
],
];
$this->configFactory = $this
->getConfigFactoryStub($this->configFactoryConfiguration);
$this->entityTypeBundleInfo = $this
->prophesize(EntityTypeBundleInfoInterface::class)
->reveal();
$this->time = $this
->prophesize(TimeInterface::class)
->reveal();
$this->sut = new PaymentForm($this->entityRepository, $this->entityTypeBundleInfo, $this->time);
$this->sut
->setStringTranslation($this->stringTranslation);
$this->sut
->setConfigFactory($this->configFactory);
$this->sut
->setEntity($this->payment);
$this->sut
->setPluginSelectorManager($this->pluginSelectorManager);
$this->sut
->setPaymentMethodPluginType($this->paymentMethodType
->reveal());
$this->sut
->setCurrentUser($this->currentUser);
}