AreaMessagesTest.php

Same filename in other branches
  1. 8.9.x core/modules/views/tests/src/Kernel/Handler/AreaMessagesTest.php
  2. 10 core/modules/views/tests/src/Kernel/Handler/AreaMessagesTest.php
  3. 11.x core/modules/views/tests/src/Kernel/Handler/AreaMessagesTest.php

Namespace

Drupal\Tests\views\Kernel\Handler

File

core/modules/views/tests/src/Kernel/Handler/AreaMessagesTest.php

View source
<?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::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.');
    }

}

Classes

Title Deprecated Summary
AreaMessagesTest Tests the messages area handler.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.