You are here

function Braintree_AddressTest::testUpdate_withValidationErrors_onCountry in Commerce Braintree 7

File

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

Class

Braintree_AddressTest

Code

function testUpdate_withValidationErrors_onCountry() {
  $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(
    'countryCodeAlpha2' => 'MU',
    'countryCodeAlpha3' => 'MYT',
  ));
  $this
    ->assertFalse($result->success);
  $countryErrors = $result->errors
    ->forKey('address')
    ->onAttribute('base');
  $this
    ->assertEquals(Braintree_Error_Codes::ADDRESS_INCONSISTENT_COUNTRY, $countryErrors[0]->code);
}