function Braintree_Error_ErrorCollectionTest::testOnHtmlField in Commerce Braintree 7
File
- braintree_php/
tests/ integration/ Error/ ErrorCollectionTest.php, line 22
Class
Code
function testOnHtmlField() {
$result = Braintree_Customer::create(array(
'email' => 'invalid',
'creditCard' => array(
'number' => 'invalid',
'expirationDate' => 'invalid',
'billingAddress' => array(
'countryName' => 'invaild',
),
),
));
$this
->assertEquals(false, $result->success);
$errors = $result->errors
->onHtmlField('customer[email]');
$this
->assertEquals(Braintree_Error_Codes::CUSTOMER_EMAIL_IS_INVALID, $errors[0]->code);
$errors = $result->errors
->onHtmlField('customer[credit_card][number]');
$this
->assertEquals(Braintree_Error_Codes::CREDIT_CARD_NUMBER_INVALID_LENGTH, $errors[0]->code);
$errors = $result->errors
->onHtmlField('customer[credit_card][billing_address][country_name]');
$this
->assertEquals(Braintree_Error_Codes::ADDRESS_COUNTRY_NAME_IS_NOT_ACCEPTED, $errors[0]->code);
}