You are here

protected function PaymentMethodStorageTest::setUp in Commerce Core 8.2

Overrides OrderKernelTestBase::setUp

File

modules/payment/tests/src/Kernel/PaymentMethodStorageTest.php, line 59

Class

PaymentMethodStorageTest
Tests the payment method storage.

Namespace

Drupal\Tests\commerce_payment\Kernel

Code

protected function setUp() : void {
  parent::setUp();
  $this
    ->installEntitySchema('commerce_payment');
  $this
    ->installEntitySchema('commerce_payment_method');
  $this
    ->installConfig('commerce_payment');
  $payment_gateway = PaymentGateway::create([
    'id' => 'example',
    'label' => 'Example',
    'plugin' => 'example_onsite',
  ]);
  $payment_gateway
    ->setPluginConfiguration([
    'api_key' => '2342fewfsfs',
    'mode' => 'test',
    'payment_method_types' => [
      'credit_card',
    ],
  ]);
  $payment_gateway
    ->save();
  $this->paymentGateway = $this
    ->reloadEntity($payment_gateway);
  $user = $this
    ->createUser();
  $this->user = $this
    ->reloadEntity($user);
  $this->storage = $this->container
    ->get('entity_type.manager')
    ->getStorage('commerce_payment_method');

  // Always 2 years in the future.
  $this->futureExpire = time() + 2 * 365 * 24 * 60 * 60;
}