You are here

function Braintree_CustomerTest::testCreate_withCountry in Commerce Braintree 7

File

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

Class

Braintree_CustomerTest

Code

function testCreate_withCountry() {
  $result = Braintree_Customer::create(array(
    'firstName' => 'Bat',
    'lastName' => 'Manderson',
    'creditCard' => array(
      'number' => '5105105105105100',
      'expirationDate' => '05/12',
      'billingAddress' => array(
        'countryName' => 'Gabon',
        'countryCodeAlpha2' => 'GA',
        'countryCodeAlpha3' => 'GAB',
        'countryCodeNumeric' => '266',
      ),
    ),
  ));
  $this
    ->assertEquals(true, $result->success);
  $customer = $result->customer;
  $this
    ->assertEquals('Gabon', $customer->creditCards[0]->billingAddress->countryName);
  $this
    ->assertEquals('GA', $customer->creditCards[0]->billingAddress->countryCodeAlpha2);
  $this
    ->assertEquals('GAB', $customer->creditCards[0]->billingAddress->countryCodeAlpha3);
  $this
    ->assertEquals('266', $customer->creditCards[0]->billingAddress->countryCodeNumeric);
  $this
    ->assertEquals(1, preg_match('/\\A\\w{32}\\z/', $customer->creditCards[0]->uniqueNumberIdentifier));
}