function ComponentRenderInvalidTest::testInvalidDefinitionTheme
Same name in this branch
- 11.x core/modules/sdc/tests/src/Kernel/ComponentRenderInvalidTest.php \Drupal\Tests\sdc\Kernel\ComponentRenderInvalidTest::testInvalidDefinitionTheme()
Same name in other branches
- 10 core/modules/sdc/tests/src/Kernel/ComponentRenderInvalidTest.php \Drupal\Tests\sdc\Kernel\ComponentRenderInvalidTest::testInvalidDefinitionTheme()
- 10 core/tests/Drupal/KernelTests/Components/ComponentRenderInvalidTest.php \Drupal\KernelTests\Components\ComponentRenderInvalidTest::testInvalidDefinitionTheme()
Ensure that components in modules without schema fail validation.
The theme sdc_theme_test_enforce_schema_invalid is set as enforcing schemas but provides a component without schema.
File
-
core/
tests/ Drupal/ KernelTests/ Components/ ComponentRenderInvalidTest.php, line 44
Class
- ComponentRenderInvalidTest
- Tests invalid render options for components.
Namespace
Drupal\KernelTests\ComponentsCode
public function testInvalidDefinitionTheme() : void {
\Drupal::service('theme_installer')->install([
'sdc_theme_test_enforce_schema_invalid',
]);
$active_theme = \Drupal::service('theme.initialization')->initTheme('sdc_theme_test_enforce_schema_invalid');
\Drupal::service('theme.manager')->setActiveTheme($active_theme);
$this->expectException(InvalidComponentException::class);
$this->manager
->getDefinitions();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.