summaryrefslogtreecommitdiff
path: root/modules/simpletest
diff options
context:
space:
mode:
authorDavid Rothstein <drothstein@gmail.com>2013-12-30 09:30:59 -0500
committerDavid Rothstein <drothstein@gmail.com>2013-12-30 09:30:59 -0500
commit001532a06e070f209c2e771720435a3e08c0cc8c (patch)
treefc257c99612c424cf557377fbe9acde97e610722 /modules/simpletest
parentf362e6ae18cdd14e8a998393f711c3e5fdaae151 (diff)
downloadbrdo-001532a06e070f209c2e771720435a3e08c0cc8c.tar.gz
brdo-001532a06e070f209c2e771720435a3e08c0cc8c.tar.bz2
Issue #2054205 by pfrenssen, Berdir: Broken Tests on PHP 5.5.
Diffstat (limited to 'modules/simpletest')
-rw-r--r--modules/simpletest/drupal_web_test_case.php18
1 files changed, 17 insertions, 1 deletions
diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php
index cb15a6367..6d0e59a4a 100644
--- a/modules/simpletest/drupal_web_test_case.php
+++ b/modules/simpletest/drupal_web_test_case.php
@@ -541,6 +541,15 @@ abstract class DrupalTestCase {
E_RECOVERABLE_ERROR => 'Recoverable error',
);
+ // PHP 5.3 adds new error logging constants. Add these conditionally for
+ // backwards compatibility with PHP 5.2.
+ if (defined('E_DEPRECATED')) {
+ $error_map += array(
+ E_DEPRECATED => 'Deprecated',
+ E_USER_DEPRECATED => 'User deprecated',
+ );
+ }
+
$backtrace = debug_backtrace();
$this->error($message, $error_map[$severity], _drupal_get_last_caller($backtrace));
}
@@ -2046,7 +2055,14 @@ class DrupalWebTestCase extends DrupalTestCase {
foreach ($upload as $key => $file) {
$file = drupal_realpath($file);
if ($file && is_file($file)) {
- $post[$key] = '@' . $file;
+ // Use the new CurlFile class for file uploads when using PHP
+ // 5.5 or higher.
+ if (class_exists('CurlFile')) {
+ $post[$key] = curl_file_create($file);
+ }
+ else {
+ $post[$key] = '@' . $file;
+ }
}
}
}