#335035: simpletest should skip disabled field on POST submissions.

From: Damien Tournoud <damien@tournoud.net>

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/node/node.test                      |    4 ++--
 modules/simpletest/drupal_web_test_case.php |   11 ++++++++++-
 2 files changed, 12 insertions(+), 3 deletions(-)


diff --git modules/node/node.test modules/node/node.test
index f212598..4165ffe 100644
--- modules/node/node.test
+++ modules/node/node.test
@@ -285,7 +285,7 @@ class PageEditTestCase extends DrupalWebTestCase {
     // Check that the title and body fields are displayed with the correct values.
     $this->assertLink(t('Edit'), 0, t('Edit tab found.'));
     $this->assertFieldByName('title', $edit['title'], t('Title field displayed.'));
-    $this->assertFieldByName('body', '<!--break-->' . $edit['body'], t('Body field displayed.'));
+    $this->assertFieldByName('body', $edit['body'], t('Body field displayed.'));
 
     // Edit the content of the node.
     $edit = array();
@@ -339,7 +339,7 @@ class PagePreviewTestCase extends DrupalWebTestCase {
 
     // Check that the title and body fields are displayed with the correct values.
     $this->assertFieldByName('title', $edit['title'], t('Title field displayed.'));
-    $this->assertFieldByName('body', '<!--break-->' . $edit['body'], t('Body field displayed.'));
+    $this->assertFieldByName('body', $edit['body'], t('Body field displayed.'));
   }
 }
 
diff --git modules/simpletest/drupal_web_test_case.php modules/simpletest/drupal_web_test_case.php
index 2c60f05..1ee768f 100644
--- modules/simpletest/drupal_web_test_case.php
+++ modules/simpletest/drupal_web_test_case.php
@@ -1088,7 +1088,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) {
@@ -1127,6 +1127,15 @@ class DrupalWebTestCase {
             break;
         }
       }
+      else {
+        // 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
+        // Note that we still allow values to be forcefully submitted to those
+        // fields, because it could required for some test cases.
+        if (!empty($element['disabled'])) {
+          continue;
+        }
+      }
       if (!isset($post[$name]) && !$done) {
         switch ($type) {
           case 'textarea':
