You are here

function Braintree_CustomerTest::testUpdate_withNewCreditCardAndExistingBillingAddress in Commerce Braintree 7

File

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

Class

Braintree_CustomerTest

Code

function testUpdate_withNewCreditCardAndExistingBillingAddress() {
  $customer = Braintree_Customer::create()->customer;
  $address = Braintree_Address::create(array(
    'customerId' => $customer->id,
    'firstName' => 'Dan',
  ))->address;
  $result = Braintree_Customer::update($customer->id, array(
    'creditCard' => array(
      'number' => '4111111111111111',
      'expirationDate' => '11/14',
      'billingAddressId' => $address->id,
    ),
  ));
  $billingAddress = $result->customer->creditCards[0]->billingAddress;
  $this
    ->assertEquals($address->id, $billingAddress->id);
  $this
    ->assertEquals('Dan', $billingAddress->firstName);
}