You are here

function Braintree_CreditCardTest::testUpdateFromTransparentRedirect in Commerce Braintree 7

File

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

Class

Braintree_CreditCardTest

Code

function testUpdateFromTransparentRedirect() {
  $customer = Braintree_Customer::createNoValidate();
  $creditCard = Braintree_CreditCard::createNoValidate(array(
    'customerId' => $customer->id,
    'number' => '5105105105105100',
    'expirationDate' => '05/12',
  ));
  $queryString = $this
    ->updateCreditCardViaTr(array(
    'credit_card' => array(
      'number' => '4111111111111111',
      'expiration_date' => '01/11',
    ),
  ), array(
    'paymentMethodToken' => $creditCard->token,
  ));
  $result = Braintree_CreditCard::updateFromTransparentRedirect($queryString);
  $this
    ->assertTrue($result->success);
  $this
    ->assertEquals('411111', $result->creditCard->bin);
  $this
    ->assertEquals('1111', $result->creditCard->last4);
  $this
    ->assertEquals('01/2011', $result->creditCard->expirationDate);
}