You are here

function Braintree_CustomerTest::testUpdateFromTransparentRedirect_withValidationErrors in Commerce Braintree 7

File

braintree_php/tests/integration/CustomerTest.php, line 736

Class

Braintree_CustomerTest

Code

function testUpdateFromTransparentRedirect_withValidationErrors() {
  Braintree_TestHelper::suppressDeprecationWarnings();
  $customer = Braintree_Customer::createNoValidate();
  $queryString = $this
    ->updateCustomerViaTr(array(
    'customer' => array(
      'first_name' => str_repeat('x', 256),
    ),
  ), array(
    'customerId' => $customer->id,
  ));
  $result = Braintree_Customer::updateFromTransparentRedirect($queryString);
  $this
    ->assertFalse($result->success);
  $errors = $result->errors
    ->forKey('customer')
    ->onAttribute('firstName');
  $this
    ->assertEquals(Braintree_Error_Codes::CUSTOMER_FIRST_NAME_IS_TOO_LONG, $errors[0]->code);
}