static function Generate::createPaymentMethodConfiguration in Payment 8.2
Creates a payment method configuration.
Parameters
integer $uid: The user ID of the payment method's owner.
string $plugin_id: The ID of the payment method configuration plugin to use as the entity's bundle.
Return value
\Drupal\payment\Entity\PaymentMethodConfigurationInterface
2 calls to Generate::createPaymentMethodConfiguration()
- PaymentFormWebTest::setUp in modules/
payment_form/ tests/ src/ Functional/ Plugin/ Field/ FieldFormatter/ PaymentFormWebTest.php - {@inheritdoc
- PaymentReferenceWebTest::testWidget in modules/
payment_reference/ tests/ src/ Functional/ Plugin/ Field/ FieldWidget/ PaymentReferenceWebTest.php - Tests the widget.
File
- src/
Tests/ Generate.php, line 113
Class
- Generate
- Provides utility tools to support tests.
Namespace
Drupal\payment\TestsCode
static function createPaymentMethodConfiguration($uid, $plugin_id) {
$name = static::getRandom()
->name();
/** @var \Drupal\payment\Entity\PaymentMethodConfigurationInterface $payment_method */
$payment_method = PaymentMethodConfiguration::create(array(
'pluginId' => $plugin_id,
));
$payment_method
->setId($name)
->setLabel($name)
->setOwnerId($uid);
return $payment_method;
}