diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-10-05 15:17:14 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-10-05 15:17:14 +0000 |
commit | b6fd2cd427ea059d92b85b8e378a2f644aa01089 (patch) | |
tree | 1944093b7d2fda5247af5f5521152b4bfefa3bb2 /modules | |
parent | 57759f5a8ddc85231ea2ab61d707a062dbaae000 (diff) | |
download | brdo-b6fd2cd427ea059d92b85b8e378a2f644aa01089.tar.gz brdo-b6fd2cd427ea059d92b85b8e378a2f644aa01089.tar.bz2 |
#614082 by dww, c960657: Fixed SimpleTest error collector tests fail when verbose logging is enabled.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/simpletest/tests/common.test | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/modules/simpletest/tests/common.test b/modules/simpletest/tests/common.test index 129fad037..97cea80e5 100644 --- a/modules/simpletest/tests/common.test +++ b/modules/simpletest/tests/common.test @@ -1889,14 +1889,34 @@ class DrupalErrorCollectionUnitTest extends DrupalWebTestCase { } } + /** + * Error handler that collects errors in an array. + * + * This test class is trying to verify that simpletest correctly sees errors + * and warnings. However, it can't generate errors and warnings that + * propagate up to the testing framework itself, or these tests would always + * fail. So, this special copy of error() doesn't propagate the errors up + * the class hierarchy. It just stuffs them into a protected collectedErrors + * array for various assertions to inspect. + */ protected function error($message = '', $group = 'Other', array $caller = NULL) { - // This function overiddes DrupalWebTestCase::error(). We collect an error... - $this->collectedErrors[] = array( - 'message' => $message, - 'group' => $group, - 'caller' => $caller - ); - // ... and ignore it. + // Due to a WTF elsewhere, simpletest treats debug() and verbose() + // messages as if they were an 'error'. But, we don't want to collect + // those here. This function just wants to collect the real errors (PHP + // notices, PHP fatal errors, etc.), and let all the 'errors' from the + // 'User notice' group bubble up to the parent classes to be handled (and + // eventually displayed) as normal. + if ($group == 'User notice') { + parent::error($message, $group, $caller); + } + // Everything else should be collected but not propagated. + else { + $this->collectedErrors[] = array( + 'message' => $message, + 'group' => $group, + 'caller' => $caller + ); + } } /** |