public function PaymentMethodTest::testPaymentMethodDeletionNoGateway in Commerce Core 8.2
Tests deleting a payment method without a gateway.
File
- modules/
payment/ tests/ src/ Functional/ PaymentMethodTest.php, line 283
Class
- PaymentMethodTest
- Tests the payment method UI.
Namespace
Drupal\Tests\commerce_payment\FunctionalCode
public function testPaymentMethodDeletionNoGateway() {
$payment_method = $this
->createEntity('commerce_payment_method', [
'uid' => $this->user
->id(),
'type' => 'credit_card',
'payment_gateway' => 'example',
]);
$details = [
'type' => 'visa',
'number' => '4111111111111111',
'expiration' => [
'month' => '01',
'year' => date("Y") + 1,
],
];
$this->paymentGateway
->getPlugin()
->createPaymentMethod($payment_method, $details);
$this->paymentGateway
->delete();
$this
->drupalGet($this->collectionUrl . '/' . $payment_method
->id() . '/delete');
$this
->getSession()
->getPage()
->pressButton('Delete');
$this
->assertSession()
->addressEquals($this->collectionUrl);
$payment_gateway = PaymentMethod::load($payment_method
->id());
$this
->assertNull($payment_gateway);
}