You are here

public function SquareApiIntegrationTest::testCreatePaymentBadPostalCode in Commerce Square Connect 8

Tests creating a payment, with invalid postal code error.

File

tests/src/Kernel/SquareApiIntegrationTest.php, line 119

Class

SquareApiIntegrationTest
Tests the Square SDK integration with Commerce.

Namespace

Drupal\Tests\commerce_square\Kernel

Code

public function testCreatePaymentBadPostalCode() {
  $this
    ->expectException(SoftDeclineException::class);
  $this
    ->expectExceptionCode(0);
  $this
    ->expectExceptionMessage('Postal code check failed.');

  /** @var \Drupal\commerce_square\Plugin\Commerce\PaymentGateway\SquareInterface $gateway_plugin */
  $gateway_plugin = $this->gateway
    ->getPlugin();
  $gateway_plugin
    ->createPayment($this
    ->generateTestPayment('cnon:card-nonce-rejected-postalcode'));
}