You are here

function Braintree_CreditCardTest::testCreate_withExistingBillingAddress in Commerce Braintree 7

File

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

Class

Braintree_CreditCardTest

Code

function testCreate_withExistingBillingAddress() {
  $customer = Braintree_Customer::createNoValidate();
  $existingAddress = Braintree_Address::createNoValidate(array(
    'customerId' => $customer->id,
    'firstName' => 'John',
  ));
  $result = Braintree_CreditCard::create(array(
    'customerId' => $customer->id,
    'number' => '5105105105105100',
    'expirationDate' => '05/12',
    'billingAddressId' => $existingAddress->id,
  ));
  $this
    ->assertTrue($result->success);
  $address = $result->creditCard->billingAddress;
  $this
    ->assertEquals($existingAddress->id, $address->id);
  $this
    ->assertEquals('John', $address->firstName);
}