? drupalpost.test ? sites/default/files ? sites/default/settings.php Index: modules/simpletest/drupal_web_test_case.php =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/drupal_web_test_case.php,v retrieving revision 1.15 diff -u -p -r1.15 drupal_web_test_case.php --- modules/simpletest/drupal_web_test_case.php 6 Jun 2008 10:36:44 -0000 1.15 +++ modules/simpletest/drupal_web_test_case.php 6 Jun 2008 20:34:54 -0000 @@ -552,10 +552,22 @@ class DrupalWebTestCase extends UnitTest // We post only if we managed to handle every field in edit and the // submit button matches. if (!$edit && $submit_matches) { - // cURL will handle file upload for us if asked kindly. - foreach ($upload as $key => $file) { - $post[$key] = '@' . realpath($file); + if ($upload) { + // cURL will handle file upload for us if asked kindly. + foreach ($upload as $key => $file) { + $post[$key] = '@' . realpath($file); + } } + else { + $post_array = $post; + $post = array(); + foreach ($post_array as $key => $value) { + // Whether this needs to be urlencode or rawurlencode, is not + // quite clear, but this seems to be the better choice. + $post[] = urlencode($key) . '=' . urlencode($value); + } + $post = implode('&', $post); + } $out = $this->curlExec(array(CURLOPT_URL => $action, CURLOPT_POST => TRUE, CURLOPT_POSTFIELDS => $post)); // Ensure that any changes to variables in the other thread are picked up. $this->refreshVariables();