#335035: simpletest should skip disabled field on POST submissions. From: Damien Tournoud According to [1], disabled controls cannot be successful (ie. 'valid for submission'). [1] http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.12 --- modules/simpletest/drupal_web_test_case.php | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git modules/simpletest/drupal_web_test_case.php modules/simpletest/drupal_web_test_case.php index 2c60f05..ccf67c9 100644 --- modules/simpletest/drupal_web_test_case.php +++ modules/simpletest/drupal_web_test_case.php @@ -1066,6 +1066,11 @@ class DrupalWebTestCase { $elements = $form->xpath('.//input|.//textarea|.//select'); $submit_matches = FALSE; foreach ($elements as $element) { + // Ignore disabled elements, as those cannot be 'successful' (ie. integrated + // in form submission), according to http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.12 + if (isset($element['disabled'])) { + continue; + } // SimpleXML objects need string casting all the time. $name = (string) $element['name']; // This can either be the type of or the name of the tag itself @@ -1088,7 +1093,7 @@ class DrupalWebTestCase { } break; case 'checkbox': - // To prevent checkbox from being checked.pass in a FALSE, + // To prevent checkbox from being checked, pass in a FALSE, // otherwise the checkbox will be set to its value regardless // of $edit. if ($edit[$name] === FALSE) {