Issue #1445224 follow-up by sun, tim.plunkett: Fixed broken tests.
parent
25248da99a
commit
a73d65122c
|
@ -1041,6 +1041,8 @@ function form_test_form_state_values_clean_advanced_form_submit($form, &$form_st
|
|||
* Build a form to test a checkbox.
|
||||
*/
|
||||
function _form_test_checkbox($form, &$form_state) {
|
||||
$form['#submit'] = array('_form_test_submit_values_json');
|
||||
|
||||
// A required checkbox.
|
||||
$form['required_checkbox'] = array(
|
||||
'#type' => 'checkbox',
|
||||
|
@ -1104,20 +1106,12 @@ function _form_test_checkbox($form, &$form_state) {
|
|||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the form values via JSON.
|
||||
*/
|
||||
function _form_test_checkbox_submit($form, &$form_state) {
|
||||
// This won't have a proper JSON header, but Drupal doesn't check for that
|
||||
// anyway so this is fine until it's replaced with a JsonResponse.
|
||||
print drupal_json_encode($form_state['values']);
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a form to test #type 'select' validation.
|
||||
*/
|
||||
function form_test_select($form, &$form_state) {
|
||||
$form['#submit'] = array('_form_test_submit_values_json');
|
||||
|
||||
$base = array(
|
||||
'#type' => 'select',
|
||||
'#options' => drupal_map_assoc(array('one', 'two', 'three')),
|
||||
|
@ -1215,16 +1209,6 @@ function form_test_select($form, &$form_state) {
|
|||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Form submit handler for form_test_select().
|
||||
*/
|
||||
function form_test_select_submit($form, &$form_state) {
|
||||
// This won't have a proper JSON header, but Drupal doesn't check for that
|
||||
// anyway so this is fine until it's replaced with a JsonResponse.
|
||||
print drupal_json_encode($form_state['values']);
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a form to test #type 'number' and 'range' validation.
|
||||
*
|
||||
|
@ -1350,6 +1334,8 @@ function form_test_number($form, &$form_state, $element = 'number') {
|
|||
* @ingroup forms
|
||||
*/
|
||||
function form_test_range($form, &$form_state) {
|
||||
$form['#submit'] = array('_form_test_submit_values_json');
|
||||
|
||||
$form['with_default_value'] = array(
|
||||
'#type' => 'range',
|
||||
'#title' => 'Range with default value',
|
||||
|
@ -1389,16 +1375,6 @@ function form_test_range($form, &$form_state) {
|
|||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Form submission handler for form_test_range().
|
||||
*/
|
||||
function form_test_range_submit($form, &$form_state) {
|
||||
// This won't have a proper JSON header, but Drupal doesn't check for that
|
||||
// anyway so this is fine until it's replaced with a JsonResponse.
|
||||
print drupal_json_encode($form_state['values']);
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Form constructor for testing invalid #type 'range' elements.
|
||||
*
|
||||
|
@ -1426,6 +1402,8 @@ function form_test_range_invalid($form, &$form_state) {
|
|||
* @ingroup forms
|
||||
*/
|
||||
function form_test_color($form, &$form_state) {
|
||||
$form['#submit'] = array('_form_test_submit_values_json');
|
||||
|
||||
$form['color'] = array(
|
||||
'#type' => 'color',
|
||||
'#title' => 'Color',
|
||||
|
@ -1437,14 +1415,6 @@ function form_test_color($form, &$form_state) {
|
|||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Form submission handler for form_test_color().
|
||||
*/
|
||||
function form_test_color_submit($form, &$form_state) {
|
||||
drupal_json_output($form_state['values']);
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a form to test the placeholder attribute.
|
||||
*/
|
||||
|
@ -1526,6 +1496,7 @@ function form_test_checkboxes_radios($form, &$form_state, $customize = FALSE) {
|
|||
* @ingroup forms
|
||||
*/
|
||||
function form_test_email($form, &$form_state) {
|
||||
$form['#submit'] = array('_form_test_submit_values_json');
|
||||
$form['email'] = array(
|
||||
'#type' => 'email',
|
||||
'#title' => 'E-Mail address',
|
||||
|
@ -1544,16 +1515,6 @@ function form_test_email($form, &$form_state) {
|
|||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Form submission handler for form_test_email().
|
||||
*/
|
||||
function form_test_email_submit($form, &$form_state) {
|
||||
// This won't have a proper JSON header, but Drupal doesn't check for that
|
||||
// anyway so this is fine until it's replaced with a JsonResponse.
|
||||
print drupal_json_encode($form_state['values']);
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Form constructor for testing #type 'url' elements.
|
||||
*
|
||||
|
@ -1561,6 +1522,7 @@ function form_test_email_submit($form, &$form_state) {
|
|||
* @ingroup forms
|
||||
*/
|
||||
function form_test_url($form, &$form_state) {
|
||||
$form['#submit'] = array('_form_test_submit_values_json');
|
||||
$form['url'] = array(
|
||||
'#type' => 'url',
|
||||
'#title' => 'Optional URL',
|
||||
|
@ -1579,20 +1541,12 @@ function form_test_url($form, &$form_state) {
|
|||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Form submission handler for form_test_url().
|
||||
*/
|
||||
function form_test_url_submit($form, &$form_state) {
|
||||
// This won't have a proper JSON header, but Drupal doesn't check for that
|
||||
// anyway so this is fine until it's replaced with a JsonResponse.
|
||||
print drupal_json_encode($form_state['values']);
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a form to test disabled elements.
|
||||
*/
|
||||
function _form_test_disabled_elements($form, &$form_state) {
|
||||
$form['#submit'] = array('_form_test_submit_values_json');
|
||||
|
||||
// Elements that take a simple default value.
|
||||
foreach (array('textfield', 'textarea', 'search', 'tel', 'hidden') as $type) {
|
||||
$form[$type] = array(
|
||||
|
@ -1791,20 +1745,12 @@ function _form_test_disabled_elements($form, &$form_state) {
|
|||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the form values via JSON.
|
||||
*/
|
||||
function _form_test_disabled_elements_submit($form, &$form_state) {
|
||||
// This won't have a proper JSON header, but Drupal doesn't check for that
|
||||
// anyway so this is fine until it's replaced with a JsonResponse.
|
||||
print drupal_json_encode($form_state['values']);
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a form to test input forgery of enabled elements.
|
||||
*/
|
||||
function _form_test_input_forgery($form, &$form_state) {
|
||||
$form['#submit'] = array('_form_test_submit_values_json');
|
||||
|
||||
// For testing that a user can't submit a value not matching one of the
|
||||
// allowed options.
|
||||
$form['checkboxes'] = array(
|
||||
|
@ -1814,7 +1760,6 @@ function _form_test_input_forgery($form, &$form_state) {
|
|||
'two' => 'Two',
|
||||
),
|
||||
);
|
||||
|
||||
$form['submit'] = array(
|
||||
'#type' => 'submit',
|
||||
'#value' => t('Submit'),
|
||||
|
@ -1822,16 +1767,6 @@ function _form_test_input_forgery($form, &$form_state) {
|
|||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the form values via JSON.
|
||||
*/
|
||||
function _form_test_input_forgery_submit($form, &$form_state) {
|
||||
// This won't have a proper JSON header, but Drupal doesn't check for that
|
||||
// anyway so this is fine until it's replaced with a JsonResponse.
|
||||
print drupal_json_encode($form_state['values']);
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Form builder for testing preservation of values during a rebuild.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue