function Braintree_TransactionTest::testVoid_withValidationError in Commerce Braintree 7
File
- braintree_php/
tests/ integration/ TransactionTest.php, line 781
Class
Code
function testVoid_withValidationError() {
$transaction = Braintree_Transaction::saleNoValidate(array(
'amount' => '100.00',
'creditCard' => array(
'number' => '5105105105105100',
'expirationDate' => '05/12',
),
));
$this
->assertEquals(Braintree_Transaction::AUTHORIZED, $transaction->status);
$voided = Braintree_Transaction::voidNoValidate($transaction->id);
$this
->assertEquals(Braintree_Transaction::VOIDED, $voided->status);
$result = Braintree_Transaction::void($transaction->id);
$this
->assertEquals(false, $result->success);
$errors = $result->errors
->forKey('transaction')
->onAttribute('base');
$this
->assertEquals(Braintree_Error_Codes::TRANSACTION_CANNOT_BE_VOIDED, $errors[0]->code);
}