summaryrefslogtreecommitdiff
path: root/modules/simpletest/drupal_web_test_case.php
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2008-06-06 10:36:45 +0000
committerDries Buytaert <dries@buytaert.net>2008-06-06 10:36:45 +0000
commit5c9d4b9c97ad4097676bd1da4c4467dc7f2e8125 (patch)
treed740e49c83236a3bbf7429c9509310a2c5955127 /modules/simpletest/drupal_web_test_case.php
parent4f1af19d101c1940235850a7ea67a0ee7af85880 (diff)
downloadbrdo-5c9d4b9c97ad4097676bd1da4c4467dc7f2e8125.tar.gz
brdo-5c9d4b9c97ad4097676bd1da4c4467dc7f2e8125.tar.bz2
- Patch #253506 by Daniel, flobruit and catch: made the upload tests work.
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;