You are here

public function PaymentGatewayTest::testDelete in Commerce Core 8.2

Tests deleting a payment gateway.

File

modules/payment/tests/src/Functional/PaymentGatewayTest.php, line 152

Class

PaymentGatewayTest
Tests the payment gateway UI.

Namespace

Drupal\Tests\commerce_payment\Functional

Code

public function testDelete() {
  $payment_gateway = $this
    ->createEntity('commerce_payment_gateway', [
    'id' => 'for_deletion',
    'label' => 'For deletion',
    'plugin' => 'example_offsite_redirect',
  ]);
  $this
    ->drupalGet($payment_gateway
    ->toUrl('delete-form'));
  $this
    ->submitForm([], 'Delete');
  $this
    ->assertSession()
    ->addressEquals('admin/commerce/config/payment-gateways');
  $payment_gateway_exists = (bool) PaymentGateway::load('for_deletion');
  $this
    ->assertEmpty($payment_gateway_exists, 'The payment gateway has been deleted from the database.');
}