You are here

public function BraintreeApiIntegrationTest::testCreatePaymentApplicationIncomplete in Commerce Braintree 8

Tests creating a payment, with application incomplete.

@dataProvider dataProviderBillingProfile

File

tests/src/Kernel/BraintreeApiIntegrationTest.php, line 109

Class

BraintreeApiIntegrationTest
Tests the Braintree SDK integration.

Namespace

Drupal\Tests\commerce_braintree\Kernel

Code

public function testCreatePaymentApplicationIncomplete($billing_profile) {
  $this
    ->expectException(HardDeclineException::class);
  $this
    ->expectExceptionMessage('Rejected by the gateway. Reason: application_incomplete');

  /** @var \Drupal\commerce_braintree\Plugin\Commerce\PaymentGateway\HostedFieldsInterface $gateway_plugin */
  $gateway_plugin = $this->gateway
    ->getPlugin();
  $gateway_plugin
    ->createPayment($this
    ->generateTestPayment($billing_profile, '5001.00'));
  throw new \Exception('Charge should not have been successful.');
}