From aef32bf31119e2bd5c20b12a0f9391df1bd634f9 Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Sat, 11 Dec 2010 06:22:33 +0000 Subject: #991340 follow-up: Committed missing test files. --- modules/user/tests/user_form_test.info | 8 ++++ modules/user/tests/user_form_test.module | 65 ++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 modules/user/tests/user_form_test.info create mode 100644 modules/user/tests/user_form_test.module (limited to 'modules/user') diff --git a/modules/user/tests/user_form_test.info b/modules/user/tests/user_form_test.info new file mode 100644 index 000000000..ca7b9e7a1 --- /dev/null +++ b/modules/user/tests/user_form_test.info @@ -0,0 +1,8 @@ +; $Id$ +name = "User module form tests" +description = "Support module for user form testing." +package = Testing +version = VERSION +core = 7.x +files[] = user_form_test.module +hidden = TRUE diff --git a/modules/user/tests/user_form_test.module b/modules/user/tests/user_form_test.module new file mode 100644 index 000000000..e0a7d27c2 --- /dev/null +++ b/modules/user/tests/user_form_test.module @@ -0,0 +1,65 @@ + 'User form test for current password validation', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('user_form_test_current_password',1), + 'access arguments' => array('administer users'), + 'type' => MENU_SUGGESTED_ITEM, + ); + return $items; +} + +/** + * A test form for user_validate_current_pass(). + */ +function user_form_test_current_password($form, &$form_state, $account) { + $account->user_form_test_field = ''; + $form['#user'] = $account; + + $form['user_form_test_field'] = array( + '#type' => 'textfield', + '#title' => t('Test field'), + '#description' => t('A field that would require a correct password to change.'), + '#required' => TRUE, + ); + + $form['current_pass'] = array( + '#type' => 'password', + '#title' => t('Current password'), + '#size' => 25, + '#description' => t('Enter your current password'), + ); + + $form['current_pass_required_values'] = array( + '#type' => 'value', + '#value' => array('user_form_test_field' => t('Test field')), + ); + + $form['#validate'][] = 'user_validate_current_pass'; + $form['submit'] = array( + '#type' => 'submit', + '#value' => t('Test'), + ); + return $form; +} + +/** + * Submit function for the test form for user_validate_current_pass(). + */ +function user_form_test_current_password_submit($form, &$form_state) { + drupal_set_message(t('The password has been validated and the form submitted successfully.')); +} -- cgit v1.2.3