You are here

function Braintree_CreditCardTest::testFind in Commerce Braintree 7

File

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

Class

Braintree_CreditCardTest

Code

function testFind() {
  $customer = Braintree_Customer::createNoValidate();
  $result = Braintree_CreditCard::create(array(
    'customerId' => $customer->id,
    'cardholderName' => 'Cardholder',
    'number' => '5105105105105100',
    'expirationDate' => '05/12',
  ));
  $this
    ->assertTrue($result->success);
  $creditCard = Braintree_CreditCard::find($result->creditCard->token);
  $this
    ->assertEquals($customer->id, $creditCard->customerId);
  $this
    ->assertEquals('510510', $creditCard->bin);
  $this
    ->assertEquals('5100', $creditCard->last4);
  $this
    ->assertEquals('Cardholder', $creditCard->cardholderName);
  $this
    ->assertEquals('05/2012', $creditCard->expirationDate);
  $this
    ->assertEquals(array(), $creditCard->subscriptions);
}