You are here

public function MobileNumberElementTestCase::submitFormElement in Mobile Number 7

Submit custom form.

3 calls to MobileNumberElementTestCase::submitFormElement()
MobileNumberElementTestCase::testNumberValidity in tests/mobile_number.element.test
Test number validation.
MobileNumberElementTestCase::testTfa in tests/mobile_number.element.test
Test tfa option.
MobileNumberElementTestCase::testVerification in tests/mobile_number.element.test
Test number verification.

File

tests/mobile_number.element.test, line 230

Class

MobileNumberElementTestCase
Class for testing mobile_number element.

Code

public function submitFormElement($element, $input, $unset_verified_number = NULL) {
  if ($unset_verified_number) {
    flood_clear_event('mobile_number_verification', $unset_verified_number);
    unset($_SESSION['mobile_number_verification'][$unset_verified_number]['verified']);
  }
  $form_id = $this
    ->randomName();
  $form = array();
  $form_state = form_state_defaults();
  form_clear_error();
  $form['op'] = array(
    '#type' => 'submit',
    '#value' => t('Submit'),
  );
  $form['mobile_number'] = $element;
  $form_state['input']['mobile_number'] = $input;
  $form_state['input']['form_id'] = $form_id;
  $form_state['method'] = 'post';

  // The form token CSRF protection should not interfere with this test,
  // so we bypass it by marking this test form as programmed.
  $form_state['programmed'] = TRUE;
  drupal_prepare_form($form_id, $form, $form_state);
  drupal_process_form($form_id, $form, $form_state);
  return form_get_errors();
}