function Braintree_CreditCardTest::testUpdate_withDefault in Commerce Braintree 7
File
- braintree_php/
tests/ integration/ CreditCardTest.php, line 822
Class
Code
function testUpdate_withDefault() {
$customer = Braintree_Customer::createNoValidate();
$card1 = Braintree_CreditCard::create(array(
'customerId' => $customer->id,
'cardholderName' => 'Cardholder',
'number' => '5105105105105100',
'expirationDate' => '05/12',
))->creditCard;
$card2 = Braintree_CreditCard::create(array(
'customerId' => $customer->id,
'cardholderName' => 'Cardholder',
'number' => '5105105105105100',
'expirationDate' => '05/12',
))->creditCard;
$this
->assertTrue($card1
->isDefault());
$this
->assertFalse($card2
->isDefault());
Braintree_CreditCard::update($card2->token, array(
'options' => array(
'makeDefault' => true,
),
))->creditCard;
$this
->assertFalse(Braintree_CreditCard::find($card1->token)
->isDefault());
$this
->assertTrue(Braintree_CreditCard::find($card2->token)
->isDefault());
}