You are here

function Braintree_CreditCardTest::testCreate_withSpecifyingToken in Commerce Braintree 7

File

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

Class

Braintree_CreditCardTest

Code

function testCreate_withSpecifyingToken() {
  $token = strval(rand());
  $customer = Braintree_Customer::createNoValidate();
  $result = Braintree_CreditCard::create(array(
    'customerId' => $customer->id,
    'number' => '5105105105105100',
    'expirationDate' => '05/2011',
    'token' => $token,
  ));
  $this
    ->assertTrue($result->success);
  $this
    ->assertEquals($token, $result->creditCard->token);
  $this
    ->assertEquals($token, Braintree_CreditCard::find($token)->token);
}