function ElementInfoIntegrationTest::testElementInfoByTheme
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/Render/ElementInfoIntegrationTest.php \Drupal\KernelTests\Core\Render\ElementInfoIntegrationTest::testElementInfoByTheme()
- 10 core/tests/Drupal/KernelTests/Core/Render/ElementInfoIntegrationTest.php \Drupal\KernelTests\Core\Render\ElementInfoIntegrationTest::testElementInfoByTheme()
- 11.x core/tests/Drupal/KernelTests/Core/Render/ElementInfoIntegrationTest.php \Drupal\KernelTests\Core\Render\ElementInfoIntegrationTest::testElementInfoByTheme()
Ensures that the element info can be altered by themes.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Render/ ElementInfoIntegrationTest.php, line 26
Class
- ElementInfoIntegrationTest
- Tests the element info.
Namespace
Drupal\KernelTests\Core\RenderCode
public function testElementInfoByTheme() {
/** @var \Drupal\Core\Theme\ThemeInitializationInterface $theme_initializer */
$theme_initializer = $this->container
->get('theme.initialization');
/** @var \Drupal\Core\Theme\ThemeManagerInterface $theme_manager */
$theme_manager = $this->container
->get('theme.manager');
/** @var \Drupal\Core\Render\ElementInfoManagerInterface $element_info */
$element_info = $this->container
->get('plugin.manager.element_info');
$theme_manager->setActiveTheme($theme_initializer->getActiveThemeByName('classy'));
$this->assertEqual(60, $element_info->getInfo('textfield')['#size']);
$theme_manager->setActiveTheme($theme_initializer->getActiveThemeByName('test_theme'));
$this->assertEqual(40, $element_info->getInfo('textfield')['#size']);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.