Skip to content

Commit

Permalink
EWPP-1997: Update status message test.
Browse files Browse the repository at this point in the history
  • Loading branch information
22Alexandra committed Feb 18, 2022
1 parent 12ee21c commit b00517a
Showing 1 changed file with 19 additions and 22 deletions.
41 changes: 19 additions & 22 deletions tests/src/Kernel/StatusMessagesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,9 @@ public function testStatusMessages(array $data): void {
$this->assertCount(1, $title, sprintf('Wrong number of headings found for "%s" messages.', $type));
$this->assertEquals($heading, trim($title->first()->text()));

$list_items = $wrapper->filter('p.ecl-message__description span');
$this->assertSameSize($messages, $list_items, sprintf('Wrong number of "%s" messages found.', $type));

foreach ($messages as $delta => $message) {
$this->assertEquals($message, trim($list_items->eq($delta)->text()));
}
$description = $wrapper->filter('div.ecl-message__description');
$this->assertCount(1, $description, sprintf('Wrong number of "%s" messages found.', $type));
$this->assertEquals(implode($messages), trim($description->text()));
}

// Verify that no message types other than the ones present in the test data
Expand Down Expand Up @@ -124,25 +121,25 @@ public function statusMessagesProvider(): array {
[
[
MessengerInterface::TYPE_STATUS => [
'Status message 1.',
'Status message 2.',
'<p>Status message 1.</p><br>',
'Status message <strong>2</strong>.',
],
],
],
// A test case with a single "warning" message.
[
[
MessengerInterface::TYPE_WARNING => [
'Warning message 1.',
'<div>Warning message 1.</div>',
],
],
],
// A test case with multiple "warning" messages.
[
[
MessengerInterface::TYPE_WARNING => [
'Warning message 1.',
'Warning message 2.',
'<p>Warning message 1.</p><br>',
'Warning message 2.<br>',
'Warning message 3.',
],
],
Expand All @@ -159,9 +156,9 @@ public function statusMessagesProvider(): array {
[
[
MessengerInterface::TYPE_ERROR => [
'Error message 1.',
'Error message 2.',
'Error message 3.',
'<h3>Error message 1.</h3><br>',
'<p>Error message 2.</p><br>',
'Error message 3.<br>',
'Error message 4.',
],
],
Expand All @@ -170,23 +167,23 @@ public function statusMessagesProvider(): array {
[
[
MessengerInterface::TYPE_STATUS => [
'Status message 1.',
'<p>Status message 1.</p><br>',
],
MessengerInterface::TYPE_WARNING => [
'Warning message 1.',
'<p>Warning message 1.</p>',
],
],
],
// A test case with two message types with multiple messages for each one.
[
[
MessengerInterface::TYPE_ERROR => [
'Error message 1.',
'Error message 1.<br>',
'Error message 2.',
],
MessengerInterface::TYPE_WARNING => [
'Warning message 1.',
'Warning message 2.',
'Warning message 1.<br>',
'Warning message 2.<br>',
'Warning message 3.',
],
],
Expand All @@ -195,13 +192,13 @@ public function statusMessagesProvider(): array {
[
[
MessengerInterface::TYPE_STATUS => [
'Status message 1.',
'Status message <strong>1</strong>.',
],
MessengerInterface::TYPE_WARNING => [
'Warning message 1.',
'Warning message <strong>1</strong>.',
],
MessengerInterface::TYPE_ERROR => [
'Error message 1.',
'Error message 1.<br>',
'Error message 2.',
],
],
Expand Down

0 comments on commit b00517a

Please sign in to comment.