blob: 8d1cb854812680b2c5b20f399149516e82bb43a0 (
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
40
41
42
43
44
45
46
47
48
49
|
<?php
namespace Drupal\Tests\system\Kernel\Render;
use Drupal\KernelTests\KernelTestBase;
/**
* Tests the Classy theme.
*
* @group Theme
*/
class ClassyTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['system', 'twig_theme_test'];
/**
* {@inheritdoc}
*/
public function setUp() {
parent::setUp();
// Use the classy theme.
$this->container->get('theme_installer')->install(['classy']);
$this->container->get('config.factory')
->getEditable('system.theme')
->set('default', 'classy')
->save();
// Clear the theme registry.
$this->container->set('theme.registry', NULL);
}
/**
* Test the classy theme.
*/
public function testClassyTheme() {
\Drupal::messenger()->addError('An error occurred');
\Drupal::messenger()->addStatus('But then something nice happened');
$messages = [
'#type' => 'status_messages',
];
$this->render($messages);
$this->assertNoText('custom-test-messages-class', 'The custom class attribute value added in the status messages preprocess function is not displayed as page content.');
}
}
|