You are here

function Braintree_CreditCardTest::testUpdate_createsNewBillingAddressByDefault in Commerce Braintree 7

File

braintree_php/tests/integration/CreditCardTest.php, line 710

Class

Braintree_CreditCardTest

Code

function testUpdate_createsNewBillingAddressByDefault() {
  $customer = Braintree_Customer::createNoValidate();
  $initialCreditCard = Braintree_CreditCard::create(array(
    'customerId' => $customer->id,
    'number' => '5105105105105100',
    'expirationDate' => '05/12',
    'billingAddress' => array(
      'streetAddress' => '123 Nigeria Ave',
    ),
  ))->creditCard;
  $updatedCreditCard = Braintree_CreditCard::update($initialCreditCard->token, array(
    'billingAddress' => array(
      'region' => 'IL',
    ),
  ))->creditCard;
  $this
    ->assertEquals('IL', $updatedCreditCard->billingAddress->region);
  $this
    ->assertNull($updatedCreditCard->billingAddress->streetAddress);
  $this
    ->assertNotEquals($initialCreditCard->billingAddress->id, $updatedCreditCard->billingAddress->id);
}