class ClassyTest
Same name in this branch
- 9 core/themes/classy/tests/src/Functional/ClassyTest.php \Drupal\Tests\classy\Functional\ClassyTest
Same name and namespace in other branches
- 8.9.x core/modules/system/tests/src/Kernel/Render/ClassyTest.php \Drupal\Tests\system\Kernel\Render\ClassyTest
- 8.9.x core/tests/Drupal/FunctionalTests/Theme/ClassyTest.php \Drupal\FunctionalTests\Theme\ClassyTest
Tests the Classy theme.
@group classy @group legacy
Hierarchy
- class \Drupal\KernelTests\KernelTestBase implements \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertLegacyTrait, \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\classy\Kernel\ClassyTest extends \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of ClassyTest
File
-
core/
themes/ classy/ tests/ src/ Kernel/ ClassyTest.php, line 13
Namespace
Drupal\Tests\classy\KernelView source
class ClassyTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'system',
'twig_theme_test',
];
/**
* {@inheritdoc}
*/
public function setUp() : void {
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);
}
/**
* Tests 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.');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.