$messages =
$this->messenger->
messagesByType(MessengerInterface::TYPE_ERROR
);
$this->
assertCount(1,
$messages);
// Check getting all messages.
$messages =
$this->messenger->
all();
$this->
assertCount(3,
$messages);
$this->
assertArrayHasKey(MessengerInterface::TYPE_STATUS,
$messages);
$this->
assertArrayHasKey(MessengerInterface::TYPE_WARNING,
$messages);
$this->
assertArrayHasKey(MessengerInterface::TYPE_ERROR,
$messages);
// Check deletion.
$this->messenger->
deleteAll();
$this->
assertCount(0,
$this->messenger->
messagesByType(MessengerInterface::TYPE_STATUS
));
$this->
assertCount(0,
$this->messenger->
messagesByType(MessengerInterface::TYPE_WARNING
));
$this->
assertCount(0,
$this->messenger->
messagesByType(MessengerInterface::TYPE_ERROR
));
} /**
* Tests we do add duplicates with repeat flag.
*
* @covers ::addStatus
* @covers ::addWarning
* @covers ::addError
* @covers ::deleteByType
*/