You are here

public function AreaMessagesTest::testMessageText in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/views/tests/src/Kernel/Handler/AreaMessagesTest.php \Drupal\Tests\views\Kernel\Handler\AreaMessagesTest::testMessageText()
  2. 9 core/modules/views/tests/src/Kernel/Handler/AreaMessagesTest.php \Drupal\Tests\views\Kernel\Handler\AreaMessagesTest::testMessageText()

Tests the messages area handler.

File

core/modules/views/tests/src/Kernel/Handler/AreaMessagesTest.php, line 26

Class

AreaMessagesTest
Tests the messages area handler.

Namespace

Drupal\Tests\views\Kernel\Handler

Code

public function testMessageText() {
  \Drupal::messenger()
    ->addStatus('My drupal set message.');
  $view = Views::getView('test_area_messages');
  $view
    ->setDisplay('default');
  $this
    ->executeView($view);
  $output = $view
    ->render();
  $output = \Drupal::service('renderer')
    ->renderRoot($output);
  $this
    ->setRawContent($output);
  $this
    ->assertText('My drupal set message.');
}