Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.1201 diff -u -p -r1.1201 common.inc --- includes/common.inc 5 Aug 2010 08:36:08 -0000 1.1201 +++ includes/common.inc 6 Aug 2010 04:30:07 -0000 @@ -1005,6 +1005,15 @@ function drupal_http_request($url, array $result->error = $status_message; } + // Errors are being sent via X-Drupal-Assertion-* headers, generated by + // _drupal_log_error() in the exact form required by + // DrupalWebTestCase::error(). + foreach ($result->headers as $name => $value) { + if (preg_match('/^x-drupal-assertion-[0-9]+$/', $name)) { + call_user_func_array(array(&DrupalTestCase::$instance, 'error'), unserialize(urldecode($value))); + } + } + return $result; } /** Index: modules/simpletest/drupal_web_test_case.php =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/drupal_web_test_case.php,v retrieving revision 1.225 diff -u -p -r1.225 drupal_web_test_case.php --- modules/simpletest/drupal_web_test_case.php 19 Jul 2010 21:54:46 -0000 1.225 +++ modules/simpletest/drupal_web_test_case.php 6 Aug 2010 04:30:07 -0000 @@ -19,6 +19,14 @@ global $drupal_test_info; * Do not extend this class, use one of the subclasses in this file. */ abstract class DrupalTestCase { + + /** + * Active DrupalTestCase instance. + * + * @var object + */ + public static $instance; + /** * The test run ID. * @@ -82,6 +90,7 @@ abstract class DrupalTestCase { */ public function __construct($test_id = NULL) { $this->testId = $test_id; + self::$instance = $this; } /** @@ -392,6 +401,9 @@ abstract class DrupalTestCase { /** * Fire an error assertion. * + * Called from drupal_http_request() to record errors sent back through HTTP + * headers and thus it must be public. + * * @param $message * The message to display along with the assertion. * @param $group @@ -401,7 +413,7 @@ abstract class DrupalTestCase { * @return * FALSE. */ - protected function error($message = '', $group = 'Other', array $caller = NULL) { + public function error($message = '', $group = 'Other', array $caller = NULL) { if ($group == 'User notice') { // Since 'User notice' is set by trigger_error() which is used for debug // set the message to a status of 'debug'.