You are here

function PaymentformWebTestCase::fieldValidationExceptionError in Payment 7

Checks if a FieldValidationException contains a specified error code.

Parameters

FieldValidationException $e:

string $code:

Return value

boolean

1 call to PaymentformWebTestCase::fieldValidationExceptionError()
PaymentformTestFieldWebTestCase::testPaymentformFieldValidation in modules/paymentform/tests/paymentform_test/tests/PaymentformTestFieldWebTestCase.test
Test the paymentform field validation.

File

modules/paymentform/tests/PaymentformWebTestCase.test, line 54
Contains class PaymentformWebTestCase.

Class

PaymentformWebTestCase
Contains functionality shared by Paymentform test cases.

Code

function fieldValidationExceptionError(FieldValidationException $e, $code) {
  $codes = array();
  foreach ($e->errors['field_paymentform'][LANGUAGE_NONE][0] as $error) {
    if ($error['error'] == $code) {
      return TRUE;
    }
  }
  return FALSE;
}