public function BraintreeApiIntegrationTest::testCreatePaymentInsufficentFunds in Commerce Braintree 8
Tests creating a payment, with insufficient funds.
@dataProvider dataProviderBillingProfile
File
- tests/
src/ Kernel/ BraintreeApiIntegrationTest.php, line 81
Class
- BraintreeApiIntegrationTest
- Tests the Braintree SDK integration.
Namespace
Drupal\Tests\commerce_braintree\KernelCode
public function testCreatePaymentInsufficentFunds($billing_profile) {
$this
->expectException(SoftDeclineException::class);
$this
->expectExceptionMessage('Insufficient Funds (2001 : Insufficient Funds)');
/** @var \Drupal\commerce_braintree\Plugin\Commerce\PaymentGateway\HostedFieldsInterface $gateway_plugin */
$gateway_plugin = $this->gateway
->getPlugin();
$gateway_plugin
->createPayment($this
->generateTestPayment($billing_profile, '2001.00'));
throw new \Exception('Charge should not have been successful.');
}