You are here

public function TestMessenger::messagesByType in Rules 8.3

Gets all messages of a certain type.

Parameters

string $type: The messages' type. Either self::TYPE_STATUS, self::TYPE_WARNING, or self::TYPE_ERROR.

Return value

string[]|\Drupal\Component\Render\MarkupInterface[] The messages of given type.

Overrides MessengerInterface::messagesByType

File

tests/src/Unit/TestMessenger.php, line 62

Class

TestMessenger
Mock class to replace the messenger service in unit tests.

Namespace

Drupal\Tests\rules\Unit

Code

public function messagesByType($type) {
  if (!empty($type)) {
    return isset($this->messages[$type]) ? $this->messages[$type] : [];
  }
}