
| Current Path : /var/www/html/dataninja.cn/core/modules/system/tests/src/Kernel/Render/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/dataninja.cn/core/modules/system/tests/src/Kernel/Render/ClassyTest.php |
<?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.');
}
}