summaryrefslogtreecommitdiff
path: root/modules/simpletest/drupal_web_test_case.php
diff options
context:
space:
mode:
Diffstat (limited to 'modules/simpletest/drupal_web_test_case.php')
-rw-r--r--modules/simpletest/drupal_web_test_case.php26
1 files changed, 4 insertions, 22 deletions
diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php
index 543416a77..88d5a6b3c 100644
--- a/modules/simpletest/drupal_web_test_case.php
+++ b/modules/simpletest/drupal_web_test_case.php
@@ -552,29 +552,11 @@ class DrupalWebTestCase extends UnitTestCase {
// We post only if we managed to handle every field in edit and the
// submit button matches.
if (!$edit && $submit_matches) {
- // This part is not pretty. There is very little I can do.
- if ($upload) {
- foreach ($post as &$value) {
- if (strlen($value) > 0 && $value[0] == '@') {
- $this->fail(t("Can't upload and post a value starting with @"));
- return FALSE;
- }
- }
- 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);
+ // cURL will handle file upload for us if asked kindly.
+ foreach ($upload as $key => $file) {
+ $post[$key] = '@' . realpath($file);
}
- $out = $this->curlExec(array(CURLOPT_URL => $action, CURLOPT_POSTFIELDS => $post, CURLOPT_POST => TRUE));
+ $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();
return $out;