You are here

public function MatomoTestController::drupalAddMessageTest in Matomo Analytics 8

Tests setting messages and removing one before it is displayed.

Return value

array Empty array, we just test the setting of messages.

1 string reference to 'MatomoTestController::drupalAddMessageTest'
matomo_test.routing.yml in tests/modules/matomo_test/matomo_test.routing.yml
tests/modules/matomo_test/matomo_test.routing.yml

File

tests/modules/matomo_test/src/Controller/MatomoTestController.php, line 18

Class

MatomoTestController
Controller routines for system_test routes.

Namespace

Drupal\matomo_test\Controller

Code

public function drupalAddMessageTest() {

  // Set some messages.
  $this
    ->messenger()
    ->addMessage($this
    ->t('Example status message.'), 'status');
  $this
    ->messenger()
    ->addMessage($this
    ->t('Example warning message.'), 'warning');
  $this
    ->messenger()
    ->addMessage($this
    ->t('Example error message.'), 'error');
  $this
    ->messenger()
    ->addMessage($this
    ->t('Example error <em>message</em> with html tags and <a href="https://example.com/">link</a>.'), 'error');
  return [];
}