Projet

Général

Profil

Paste
Télécharger (676 octets) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / honeypot / tests / honeypot_test.module @ bc175c27

1
<?php
2

    
3
/**
4
 * Implements hook_menu().
5
 */
6
function honeypot_test_menu() {
7
  return array(
8
    'honeypot_test/submit_form' => array(
9
      'page callback' => 'honeypot_test_submit_form',
10
      'access callback' => TRUE,
11
    ),
12
  );
13
}
14

    
15
/**
16
 * Page callback: programmatically submit a form.
17
 */
18
function honeypot_test_submit_form() {
19
  module_load_include('inc', 'user', 'user.pages');
20
  $form_state = array();
21
  $form_state['values'] = array(
22
    'name' => 'robo-user',
23
    'mail' => 'robouser@example.com',
24
    'op' => t('E-mail new password'),
25
  );
26
  drupal_form_submit('user_pass', $form_state);
27
  $errors = form_get_errors();
28
  print drupal_json_encode($errors);
29
  exit();
30
}