You are here

function Braintree_TransactionTest::testSale_withTooLongPurchaseOrderAttribute in Commerce Braintree 7

File

braintree_php/tests/integration/TransactionTest.php, line 157

Class

Braintree_TransactionTest

Code

function testSale_withTooLongPurchaseOrderAttribute() {
  $result = Braintree_Transaction::sale(array(
    'amount' => '100.00',
    'creditCard' => array(
      'cardholderName' => 'The Cardholder',
      'expirationDate' => '05/2011',
      'number' => '5105105105105100',
    ),
    'purchaseOrderNumber' => 'aaaaaaaaaaaaaaaaaa',
  ));
  $this
    ->assertFalse($result->success);
  $purchaseOrderNumberErrors = $result->errors
    ->forKey('transaction')
    ->onAttribute('purchaseOrderNumber');
  $this
    ->assertEquals(Braintree_Error_Codes::TRANSACTION_PURCHASE_ORDER_NUMBER_IS_TOO_LONG, $purchaseOrderNumberErrors[0]->code);
}