You are here

function Braintree_CreditCardTest::testUpdate in Commerce Braintree 7

File

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

Class

Braintree_CreditCardTest

Code

function testUpdate() {
  $customer = Braintree_Customer::createNoValidate();
  $createResult = Braintree_CreditCard::create(array(
    'customerId' => $customer->id,
    'cardholderName' => 'Old Cardholder',
    'number' => '5105105105105100',
    'expirationDate' => '05/12',
  ));
  $this
    ->assertTrue($createResult->success);
  $updateResult = Braintree_CreditCard::update($createResult->creditCard->token, array(
    'cardholderName' => 'New Cardholder',
    'number' => '4111111111111111',
    'expirationDate' => '07/14',
  ));
  $this
    ->assertEquals($customer->id, $updateResult->creditCard->customerId);
  $this
    ->assertEquals('411111', $updateResult->creditCard->bin);
  $this
    ->assertEquals('1111', $updateResult->creditCard->last4);
  $this
    ->assertEquals('New Cardholder', $updateResult->creditCard->cardholderName);
  $this
    ->assertEquals('07/2014', $updateResult->creditCard->expirationDate);
}