You are here

function Braintree_AddressTest::testCreate_withValidationErrors in Commerce Braintree 7

File

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

Class

Braintree_AddressTest

Code

function testCreate_withValidationErrors() {
  $customer = Braintree_Customer::createNoValidate();
  $result = Braintree_Address::create(array(
    'customerId' => $customer->id,
    '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);
}