function TestMessenger::addMessage
Overrides MessengerInterface::addMessage
3 calls to TestMessenger::addMessage()
- TestMessenger::addError in tests/
src/ Unit/ TestMessenger.php - Adds a new error message to the queue.
- TestMessenger::addStatus in tests/
src/ Unit/ TestMessenger.php - Adds a new status message to the queue.
- TestMessenger::addWarning in tests/
src/ Unit/ TestMessenger.php - Adds a new warning message to the queue.
File
-
tests/
src/ Unit/ TestMessenger.php, line 22
Class
- TestMessenger
- Mock class to replace the messenger service in unit tests.
Namespace
Drupal\Tests\rules\UnitCode
public function addMessage($message, $type = self::TYPE_STATUS, $repeat = FALSE) {
if (!empty($message)) {
$this->messages[$type] = $this->messages[$type] ?? [];
if ($repeat || !in_array($message, $this->messages[$type])) {
$this->messages[$type][] = $message;
}
}
}