summaryrefslogtreecommitdiffstats
path: root/core/modules/views/tests/src/Kernel/Handler/AreaMessagesTest.php
blob: 476551c9a8ffb70e9285668e14ef4585ba80716c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php

namespace Drupal\Tests\views\Kernel\Handler;

use Drupal\Tests\views\Kernel\ViewsKernelTestBase;
use Drupal\views\Views;

/**
 * Tests the messages area handler.
 *
 * @group views
 * @see \Drupal\views\Plugin\views\area\Messages
 */
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_set_message('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.');
  }

}