diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2008-09-14 21:14:21 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2008-09-14 21:14:21 +0000 |
commit | 568034d90cb3c3832a47a61bd79cf0e708aa0d4d (patch) | |
tree | 41d80ab7814f252aa0949ae098487ec1c2c67bd2 /modules | |
parent | cf5b00c5dbe7070c1b1b89efee85e68cc62a3fb3 (diff) | |
download | brdo-568034d90cb3c3832a47a61bd79cf0e708aa0d4d.tar.gz brdo-568034d90cb3c3832a47a61bd79cf0e708aa0d4d.tar.bz2 |
#308399 by Damien Tournoud: Fix SimpleTest error handler to not spaz out and die when PHP errors are encountered.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/simpletest/simpletest.test | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/modules/simpletest/simpletest.test b/modules/simpletest/simpletest.test index 711748d79..dbb91c2ef 100644 --- a/modules/simpletest/simpletest.test +++ b/modules/simpletest/simpletest.test @@ -75,6 +75,7 @@ class SimpleTestTestCase extends DrupalWebTestCase { $this->stubTest(); } else { + // Run twice so test_ids can be accumulated. for ($i = 0; $i < 2; $i++) { // Run this test from web interface. @@ -107,11 +108,14 @@ class SimpleTestTestCase extends DrupalWebTestCase { $this->pass(t('Test ID is @id.', array('@id' => $this->test_id))); - // Generates a warning + // Generates a warning. $i = 1 / 0; // Call an assert function specific to that class. $this->assertNothing(); + + // Generates a warning inside a PHP function. + array_key_exists(NULL, NULL); } /** @@ -137,6 +141,9 @@ class SimpleTestTestCase extends DrupalWebTestCase { // Check that the backtracing code works for specific assert function. $this->assertAssertion('This is nothing.', 'Other', 'Pass', 'simpletest.test', 'SimpleTestTestCase->stubTest()'); + // Check that errors that occur inside PHP internal functions are correctly reported. + $this->assertAssertion('The second argument should be either an array or an object', 'Warning', 'Fail', 'simpletest.test', 'SimpleTestTestCase->stubTest()'); + $this->test_ids[] = $test_id = $this->getTestIdFromResults(); $this->assertTrue($test_id, t('Found test ID in results.')); } @@ -168,7 +175,7 @@ class SimpleTestTestCase extends DrupalWebTestCase { $message = trim(strip_tags($message)); $found = FALSE; foreach ($this->results['assertions'] as $assertion) { - if ($assertion['message'] == $message && + if ((strpos($assertion['message'], $message) !== FALSE) && $assertion['type'] == $type && $assertion['status'] == $status && $assertion['file'] == $file && |