summaryrefslogtreecommitdiff
path: root/modules/simpletest
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2010-03-07 18:06:06 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2010-03-07 18:06:06 +0000
commitff640c1fbb01b8df3b728bb34b8491d0499bd74f (patch)
tree67272bea2431533bda6960c3cf43c5b9aa385203 /modules/simpletest
parent1ba21f9bd8e089eaf8df1005679d5e5e0c87b90a (diff)
downloadbrdo-ff640c1fbb01b8df3b728bb34b8491d0499bd74f.tar.gz
brdo-ff640c1fbb01b8df3b728bb34b8491d0499bd74f.tar.bz2
#601398 by andypost, rfay, and sun: Fixed Simpletest does not allow assigning actions to triggers.
Diffstat (limited to 'modules/simpletest')
-rw-r--r--modules/simpletest/drupal_web_test_case.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php
index 610f43cd9..24a2acb81 100644
--- a/modules/simpletest/drupal_web_test_case.php
+++ b/modules/simpletest/drupal_web_test_case.php
@@ -1586,8 +1586,12 @@ class DrupalWebTestCase extends DrupalTestCase {
* @param $headers
* An array containing additional HTTP request headers, each formatted as
* "name: value".
+ * @param $form_id
+ * The optional string identifying the form to be submitted. On some pages
+ * there are many identical forms, so just using the value of the submit
+ * button is not enough.
*/
- protected function drupalPost($path, $edit, $submit, array $options = array(), array $headers = array()) {
+ protected function drupalPost($path, $edit, $submit, array $options = array(), array $headers = array(), $form_id = NULL) {
$submit_matches = FALSE;
$ajax = is_array($submit);
if (isset($path)) {
@@ -1596,7 +1600,11 @@ class DrupalWebTestCase extends DrupalTestCase {
if ($this->parse()) {
$edit_save = $edit;
// Let's iterate over all the forms.
- $forms = $this->xpath('//form');
+ $xpath = "//form";
+ if (!empty($form_id)) {
+ $xpath .= "[@id='" . drupal_html_id($form_id) . "']";
+ }
+ $forms = $this->xpath($xpath);
foreach ($forms as $form) {
// We try to set the fields of this form as specified in $edit.
$edit = $edit_save;