summaryrefslogtreecommitdiff
path: root/modules/simpletest/simpletest.test
diff options
context:
space:
mode:
Diffstat (limited to 'modules/simpletest/simpletest.test')
-rw-r--r--modules/simpletest/simpletest.test11
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 &&