You are here

function Braintree_AddressTest::testUpdate_withValidationErrors in Commerce Braintree 7

File

braintree_php/tests/integration/AddressTest.php, line 196

Class

Braintree_AddressTest

Code

function testUpdate_withValidationErrors() {
  $customer = Braintree_Customer::createNoValidate();
  $address = Braintree_Address::createNoValidate(array(
    'customerId' => $customer->id,
    'streetAddress' => '1 E Main St',
  ));
  $result = Braintree_Address::update($customer->id, $address->id, array(
    'countryName' => 'Invalid States of America',
  ));
  $this
    ->assertFalse($result->success);
  $countryErrors = $result->errors
    ->forKey('address')
    ->onAttribute('countryName');
  $this
    ->assertEquals(Braintree_Error_Codes::ADDRESS_COUNTRY_NAME_IS_NOT_ACCEPTED, $countryErrors[0]->code);
}