Commit d43964bc authored by catch's avatar catch

Issue #3002522 by andypost, Matthijs, tim.plunkett, wizonesolutions: Calling...

Issue #3002522 by andypost, Matthijs, tim.plunkett, wizonesolutions: Calling StatusMessages::renderMessages() with a  returns a faulty render array

(cherry picked from commit e1b6d232)
parent bad4f961
......@@ -76,7 +76,9 @@ public static function generatePlaceholder(array $element) {
public static function renderMessages($type = NULL) {
$render = [];
if (isset($type)) {
$messages = \Drupal::messenger()->deleteByType($type);
$messages = [
$type => \Drupal::messenger()->deleteByType($type),
];
}
else {
$messages = \Drupal::messenger()->deleteAll();
......
......@@ -32,6 +32,14 @@ public function testMessages() {
$this->render($messages);
$this->assertRaw('messages messages--error');
$this->assertRaw('messages messages--status');
// Tests display of only one type of messages.
\Drupal::messenger()->addError('An error occurred');
$messages = [
'#type' => 'status_messages',
'#display' => 'error',
];
$this->render($messages);
$this->assertRaw('messages messages--error');
}
}
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