Commit cd7e7cef authored by alexpott's avatar alexpott
Browse files

Issue #2547127 by dawehner, Wim Leers, legolasbo, davidhernandez, webchick:...

Issue #2547127 by dawehner, Wim Leers, legolasbo, davidhernandez, webchick: [regression] Empty messages container appearing when a Notice occurs
parent 690bbac8
......@@ -248,7 +248,8 @@ function _drupal_log_error($error, $fatal = FALSE) {
// An exception must halt script execution.
exit;
}
else {
if ($message) {
if (\Drupal::hasService('session')) {
// Message display is dependent on sessions being available.
drupal_set_message(SafeMarkup::set($message), $class, TRUE);
......
......@@ -111,6 +111,7 @@ function testErrorHandler() {
$this->assertNoErrorMessage($error_notice);
$this->assertNoErrorMessage($error_warning);
$this->assertNoErrorMessage($error_user_notice);
$this->assertNoMessages();
$this->assertNoRaw('<pre class="backtrace">', 'Did not find pre element with backtrace class.');
}
......@@ -191,4 +192,15 @@ function assertNoErrorMessage(array $error) {
$message = t('%type: !message in %function (line ', $error);
$this->assertNoRaw($message, format_string('Did not find error message: !message.', array('!message' => $message)));
}
/**
* Asserts that no messages are printed onto the page.
*
* @return bool
* TRUE, if there are no messages.
*/
protected function assertNoMessages() {
return $this->assertFalse($this->xpath('//div[contains(@class, "messages")]'), 'Ensures that also no messages div exists, which proves that no messages were generated by the error handler, not even an empty one.');
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment