function KernelTestBaseTest::testEnableModulesTheme
Tests that ThemeManager works right after loading a module.
File
-
core/
modules/ simpletest/ src/ Tests/ KernelTestBaseTest.php, line 294
Class
- KernelTestBaseTest
- Tests KernelTestBase functionality.
Namespace
Drupal\simpletest\TestsCode
public function testEnableModulesTheme() {
/** @var \Drupal\Core\Render\RendererInterface $renderer */
$renderer = $this->container
->get('renderer');
$original_element = $element = [
'#type' => 'container',
'#markup' => 'Foo',
'#attributes' => [],
];
$this->enableModules([
'system',
]);
// \Drupal\Core\Theme\ThemeManager::render() throws an exception if modules
// are not loaded yet.
$this->assertTrue($renderer->renderRoot($element));
$element = $original_element;
$this->disableModules([
'entity_test',
]);
$this->assertTrue($renderer->renderRoot($element));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.