public function GoogleAnalyticsTestController::drupalAddMessageTest in Google Analytics 8.3
Same name and namespace in other branches
- 8.2 tests/modules/google_analytics_test/src/Controller/GoogleAnalyticsTestController.php \Drupal\google_analytics_test\Controller\GoogleAnalyticsTestController::drupalAddMessageTest()
- 4.x tests/modules/google_analytics_test/src/Controller/GoogleAnalyticsTestController.php \Drupal\google_analytics_test\Controller\GoogleAnalyticsTestController::drupalAddMessageTest()
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 'GoogleAnalyticsTestController::drupalAddMessageTest'
- google_analytics_test.routing.yml in tests/
modules/ google_analytics_test/ google_analytics_test.routing.yml - tests/modules/google_analytics_test/google_analytics_test.routing.yml
File
- tests/
modules/ google_analytics_test/ src/ Controller/ GoogleAnalyticsTestController.php, line 18
Class
- GoogleAnalyticsTestController
- Controller routines for system_test routes.
Namespace
Drupal\google_analytics_test\ControllerCode
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 [];
}