function DrupalErrorHandlerTestCase::assertErrorMessage
Helper function: assert that the error message is found.
2 calls to DrupalErrorHandlerTestCase::assertErrorMessage()
- DrupalErrorHandlerTestCase::testErrorHandler in modules/
simpletest/ tests/ error.test - Test the error handler.
- DrupalErrorHandlerTestCase::testExceptionHandler in modules/
simpletest/ tests/ error.test - Test the exception handler.
File
-
modules/
simpletest/ tests/ error.test, line 103
Class
- DrupalErrorHandlerTestCase
- Tests Drupal error and exception handlers.
Code
function assertErrorMessage(array $error) {
$message = t('%type: !message in %function (line ', $error);
$this->assertRaw($message, format_string('Found error message: !message.', array(
'!message' => $message,
)));
// Also check that no full path from the error is displayed.
$this->assertNoRaw($error['%file'], format_string('Full path from error not displayed: %file.', array(
'%file' => $error['%file'],
)));
// Check that the path was displayed with the DRUPAL_ROOT hidden.
$root_length = strlen(DRUPAL_ROOT);
$stripped_path = substr($error['%file'], $root_length + 1);
$sanitized_path = t('of %path)', array(
'%path' => $stripped_path,
));
$this->assertRaw($sanitized_path, 'Path in error message was sanitized.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.