protected function UbercartBrowserTestBase::createPaymentMethod in Ubercart 8.4
Defines a new payment method.
Parameters
string $plugin_id: The plugin ID of the method.
array $values: (optional) An associative array with possible keys of 'id', and 'label', to initialize the payment method.
Return value
array Array with keys 'id' and 'value', holding the machine name and label of the created payment method.
17 calls to UbercartBrowserTestBase::createPaymentMethod()
- CartCheckoutTest::setUp in uc_cart/
tests/ src/ Functional/ CartCheckoutTest.php - CashOnDeliveryTest::testCashOnDelivery in payment/
uc_payment_pack/ tests/ src/ Functional/ CashOnDeliveryTest.php - Tests for CashOnDelivery payment method.
- CreditCardTest::configureGateway in payment/
uc_credit/ tests/ src/ Functional/ CreditCardTest.php - Helper function to configure Credit Card gateway.
- FileCheckoutTest::testCheckoutFileDownload in uc_file/
tests/ src/ Functional/ FileCheckoutTest.php - Tests that purchased files may be downloaded after checkout.
- FileTest::testFilePurchaseCheckout in uc_file/
tests/ src/ Functional/ FileTest.php - Tests that purchased files may be downloaded after checkout.
File
- uc_store/
tests/ src/ Functional/ UbercartBrowserTestBase.php, line 219
Class
- UbercartBrowserTestBase
- Base class for Ubercart PHPUnit browser tests.
Namespace
Drupal\Tests\uc_store\FunctionalCode
protected function createPaymentMethod($plugin_id, array $values = []) {
$has_user = $this->loggedInUser;
if (!$has_user) {
$this
->drupalLogin($this->adminUser);
}
$values += [
'id' => strtolower($this
->randomMachineName()),
'label' => $this
->randomString(),
];
$this
->drupalGet('admin/store/config/payment/add/' . $plugin_id);
$this
->submitForm($values, 'Save');
if (!$has_user) {
$this
->drupalLogout();
}
return $values;
}