expectException(InvalidComponentException::class); $this->expectExceptionMessage('The component "sdc_test_invalid:my-card-no-schema" does not provide schema information. Schema definitions are mandatory for components declared in modules. For components declared in themes, schema definitions are only mandatory if the "enforce_prop_schemas" key is set to "true" in the theme info file.'); $this->manager->getDefinitions(); } /** * 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. */ 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(); } }