You are here

protected function StripeIntegrationTestBase::generateGateway in Commerce Stripe 8

Generate a payment gateway for testing.

Return value

\Drupal\Core\Entity\EntityInterface|\Drupal\commerce_payment\Entity\PaymentGatewayInterface The Stripe gateway.

4 calls to StripeIntegrationTestBase::generateGateway()
CreatePaymentTest::testCreatePayment in tests/src/Kernel/CreatePaymentTest.php
Tests createPayment.
PaymentIntentTest::testCreatePaymentIntent in tests/src/Kernel/PaymentIntentTest.php
Tests creating payment intents.
PaymentIntentTest::testIntentEmptyOrderSync in tests/src/Kernel/PaymentIntentTest.php
Tests the intent sync does not fail if order was emptied.
PaymentIntentTest::testIntentOrderTotalSync in tests/src/Kernel/PaymentIntentTest.php
Tests that the order total syncs the payment intent total.

File

tests/src/Kernel/StripeIntegrationTestBase.php, line 45

Class

StripeIntegrationTestBase

Namespace

Drupal\Tests\commerce_stripe\Kernel

Code

protected function generateGateway() {
  $gateway = PaymentGateway::create([
    'id' => $this
      ->randomMachineName(),
    'label' => $this
      ->randomString(),
    'plugin' => 'stripe',
    'configuration' => [
      'payment_method_types' => [
        'credit_card',
      ],
      'publishable_key' => static::TEST_PUBLISHABLE_KEY,
      'secret_key' => static::TEST_SECRET_KEY,
    ],
  ]);
  $gateway
    ->save();
  return $this
    ->reloadEntity($gateway);
}