$current_messages =
[];
foreach (JSMessageTestController::
getMessagesSelectors() as $messagesSelector) { $web_assert->
elementExists('css',
$messagesSelector);
foreach (JSMessageTestController::
getTypes() as $type) { $this->
click('[id="add-' .
$messagesSelector . '-' .
$type . '"]'
);
$selector = "
$messagesSelector .messages.messages--
$type";
$msg_element =
$web_assert->
waitForElementVisible('css',
$selector);
$this->
assertNotEmpty($msg_element, "Message element visible:
$selector"
);
$web_assert->
elementContains('css',
$selector, "This is a message of the type,
$type. You be the judge of its importance."
);
$current_messages[$selector] = "This is a message of the type,
$type. You be the judge of its importance.";
$this->
assertCurrentMessages($current_messages,
$messagesSelector);
} // Remove messages 1 by 1 and confirm the messages are expected.
foreach (JSMessageTestController::
getTypes() as $type) { $this->
click('[id="remove-' .
$messagesSelector . '-' .
$type . '"]'
);
$selector = "
$messagesSelector .messages.messages--
$type";
// The message for this selector should not be on the page.
unset($current_messages[$selector]);
$this->
assertCurrentMessages($current_messages,
$messagesSelector);
} }