Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
project
drupal
Commits
e2825f47
Commit
e2825f47
authored
16 years ago
by
Dries Buytaert
Browse files
Options
Downloads
Patches
Plain Diff
- Patch
#293099
by boombatower: clarify form documentation and error handling.
parent
de12db43
No related branches found
No related tags found
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/simpletest/drupal_web_test_case.php
+17
-3
17 additions, 3 deletions
modules/simpletest/drupal_web_test_case.php
with
17 additions
and
3 deletions
modules/simpletest/drupal_web_test_case.php
+
17
−
3
View file @
e2825f47
...
...
@@ -824,13 +824,27 @@ function drupalGet($path, $options = array()) {
*
* @param $path
* Location of the post form. Either a Drupal path or an absolute path or
* NULL to post to the current page.
* NULL to post to the current page. For multi-stage forms you can set the
* path to NULL and have it post to the last received page. Example:
*
* // First step in form.
* $edit = array(...);
* $this->drupalPost('some_url', $edit, t('Save'));
*
* // Second step in form.
* $edit = array(...);
* $this->drupalPost(NULL, $edit, t('Save'));
* @param $edit
* Field data in an assocative array. Changes the current input fields
* (where possible) to the values indicated. A checkbox can be set to
* TRUE to be checked and FALSE to be unchecked. Note that when a form
* contains file upload fields, other fields cannot start with the '@'
* character.
*
* Multiple select fields can be set using name[] and setting each of the
* possible values. Example:
* $edit = array();
* $edit['name[]'] = array('value1', 'value2');
* @param $submit
* Value of the submit button.
* @param $options
...
...
@@ -880,11 +894,11 @@ function drupalPost($path, $edit, $submit, $options = array()) {
}
}
// We have not found a form which contained all fields of $edit.
$this
->
fail
(
t
(
'Found the requested form at @path'
,
array
(
'@path'
=>
$path
)));
$this
->
assertTrue
(
$submit_matches
,
t
(
'Found the @submit button'
,
array
(
'@submit'
=>
$submit
)));
foreach
(
$edit
as
$name
=>
$value
)
{
$this
->
fail
(
t
(
'Failed to set field @name to @value'
,
array
(
'@name'
=>
$name
,
'@value'
=>
$value
)));
}
$this
->
assertTrue
(
$submit_matches
,
t
(
'Found the @submit button'
,
array
(
'@submit'
=>
$submit
)));
$this
->
fail
(
t
(
'Found the requested form fields at @path'
,
array
(
'@path'
=>
$path
)));
}
}
...
...
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