Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-3443915
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
drupal-3443915
Commits
a73d6512
Commit
a73d6512
authored
12 years ago
by
Angie Byron
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#1445224
follow-up by sun, tim.plunkett: Fixed broken tests.
parent
25248da9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/modules/system/tests/modules/form_test/form_test.module
+14
-79
14 additions, 79 deletions
core/modules/system/tests/modules/form_test/form_test.module
with
14 additions
and
79 deletions
core/modules/system/tests/modules/form_test/form_test.module
+
14
−
79
View file @
a73d6512
...
...
@@ -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.
*/
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment