-
Notifications
You must be signed in to change notification settings - Fork 21
/
objective_forms.module
executable file
·64 lines (59 loc) · 1.46 KB
/
objective_forms.module
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
/**
* @file
* @todo include access to the form for all elements so that these hooks can
* have the appropriate values.
*/
/**
* Function Menu.
*
* !TEST CODE -- Needed for some Simple Tests!
*/
function objective_forms_menu() {
$items['objective/forms/test/%'] = array(
'title' => 'Test Form Used By SimpleTest',
'description' => 'menu_item_description',
'page callback' => 'objective_forms_test',
'page arguments' => array(3),
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
);
return $items;
}
/**
* Load a test form.
*
* @param string $form_name
* The name of the form
*
* @return html
* Returns the html
*/
function objective_forms_test($form_name) {
// Load all test files.
objective_forms_test_load_files();
// TODO needs to have $form as its first parameter.
return drupal_get_form($form_name);
}
/**
* Function test_load_files.
*
* Include all the test files so we can find the proper function for getting
* the file.
*/
function objective_forms_test_load_files() {
module_load_include('php', 'simpletest', 'drupal_web_test_case');
$include_path = drupal_get_path('module', 'objective_forms') . "/tests";
$dir = opendir($include_path);
if ($dir !== FALSE) {
while (($file = readdir($dir)) !== FALSE) {
if (preg_match('/\.test$/', $file)) {
require_once DRUPAL_ROOT . '/' . "$include_path/$file";
}
}
closedir($dir);
}
}
/**
* !END TEST CODE!
*/