StripeIntegrationTestBase.php in Commerce Stripe 8
File
tests/src/Kernel/StripeIntegrationTestBase.php
View source
<?php
namespace Drupal\Tests\commerce_stripe\Kernel;
use Drupal\commerce_payment\Entity\PaymentGateway;
use Drupal\Tests\commerce_order\Kernel\OrderKernelTestBase;
abstract class StripeIntegrationTestBase extends OrderKernelTestBase {
public static $modules = [
'commerce_payment',
'commerce_stripe',
'commerce_stripe_test',
];
const TEST_PUBLISHABLE_KEY = 'pk_test_EnquIXQLnqkP0knhcyRczqe600Iq21pkdd';
const TEST_SECRET_KEY = 'sk_test_4g69Cl9vOTJxe7bUmy5TRgWE00ytQmCnep';
protected function setUp() : void {
parent::setUp();
$this
->installEntitySchema('commerce_payment_method');
$this
->installEntitySchema('commerce_payment');
}
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);
}
}