function Braintree_CreditCardTest::testUpdate_canChangeToken in Commerce Braintree 7
File
- braintree_php/
tests/ integration/ CreditCardTest.php, line 765
Class
Code
function testUpdate_canChangeToken() {
$oldToken = strval(rand());
$newToken = strval(rand());
$customer = Braintree_Customer::createNoValidate();
$createResult = Braintree_CreditCard::create(array(
'customerId' => $customer->id,
'token' => $oldToken,
'number' => '5105105105105100',
'expirationDate' => '05/12',
));
$this
->assertTrue($createResult->success);
$updateResult = Braintree_CreditCard::update($oldToken, array(
'token' => $newToken,
));
$this
->assertEquals($customer->id, $updateResult->creditCard->customerId);
$this
->assertEquals($newToken, $updateResult->creditCard->token);
$this
->assertEquals($newToken, Braintree_CreditCard::find($newToken)->token);
}