You are here

class AreaMessagesTest 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
  2. 9 core/modules/views/tests/src/Kernel/Handler/AreaMessagesTest.php \Drupal\Tests\views\Kernel\Handler\AreaMessagesTest

Tests the messages area handler.

@group views

Hierarchy

  • class \Drupal\Tests\views\Kernel\Handler\AreaMessagesTest extends \Drupal\Tests\views\Kernel\ViewsKernelTestBase

Expanded class hierarchy of AreaMessagesTest

See also

\Drupal\views\Plugin\views\area\Messages

File

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

Namespace

Drupal\Tests\views\Kernel\Handler
View source
class AreaMessagesTest extends ViewsKernelTestBase {

  /**
   * Views used by this test.
   *
   * @var array
   */
  public static $testViews = [
    'test_area_messages',
  ];

  /**
   * Tests the messages area handler.
   */
  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.');
  }

}

Members