8d1cb854812680b2c5b20f399149516e82bb43a0
[yaffs-website] / web / core / modules / system / tests / src / Kernel / Render / ClassyTest.php
1 <?php
2
3 namespace Drupal\Tests\system\Kernel\Render;
4
5 use Drupal\KernelTests\KernelTestBase;
6
7 /**
8  * Tests the Classy theme.
9  *
10  * @group Theme
11  */
12 class ClassyTest extends KernelTestBase {
13
14   /**
15    * {@inheritdoc}
16    */
17   public static $modules = ['system', 'twig_theme_test'];
18
19   /**
20    * {@inheritdoc}
21    */
22   public function setUp() {
23     parent::setUp();
24
25     // Use the classy theme.
26     $this->container->get('theme_installer')->install(['classy']);
27     $this->container->get('config.factory')
28       ->getEditable('system.theme')
29       ->set('default', 'classy')
30       ->save();
31     // Clear the theme registry.
32     $this->container->set('theme.registry', NULL);
33
34   }
35
36   /**
37    * Test the classy theme.
38    */
39   public function testClassyTheme() {
40     \Drupal::messenger()->addError('An error occurred');
41     \Drupal::messenger()->addStatus('But then something nice happened');
42     $messages = [
43       '#type' => 'status_messages',
44     ];
45     $this->render($messages);
46     $this->assertNoText('custom-test-messages-class', 'The custom class attribute value added in the status messages preprocess function is not displayed as page content.');
47   }
48
49 }