You are here

MatomoTestController.php in Matomo Analytics 8

File

tests/modules/matomo_test/src/Controller/MatomoTestController.php
View source
<?php

namespace Drupal\matomo_test\Controller;

use Drupal\Core\Controller\ControllerBase;

/**
 * Controller routines for system_test routes.
 */
class MatomoTestController extends ControllerBase {

  /**
   * Tests setting messages and removing one before it is displayed.
   *
   * @return array
   *   Empty array, we just test the setting of messages.
   */
  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 [];
  }

}

Classes

Namesort descending Description
MatomoTestController Controller routines for system_test routes.