Loading core/modules/system/tests/modules/deprecated_module/config/install/deprecated_module.settings.yml 0 → 100644 +2 −0 Original line number Diff line number Diff line foo: bar core/modules/system/tests/modules/deprecated_module/config/schema/deprecated_module.schema.yml 0 → 100644 +7 −0 Original line number Diff line number Diff line deprecated_module.settings: type: config_object label: 'deprecated_module settings' mapping: foo: type: string label: 'Wait until you meet baz!' core/modules/system/tests/themes/test_deprecated_theme/config/install/test_deprecated_theme.settings.yml 0 → 100644 +2 −0 Original line number Diff line number Diff line favicon: use_default: true core/modules/system/tests/themes/test_deprecated_theme/config/schema/test_deprecated_theme.schema.yml 0 → 100644 +3 −0 Original line number Diff line number Diff line test_deprecated_theme.settings: type: theme_settings label: 'test_deprecated_theme settings' core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php +52 −3 Original line number Diff line number Diff line Loading @@ -49,7 +49,7 @@ class DefaultConfigTest extends KernelTestBase { /** * Tests if installed config is equal to the exported config. * * @dataProvider coreModuleListDataProvider * @dataProvider moduleListDataProvider */ public function testModuleConfig($module) { $this->assertExtensionConfig($module, 'module'); Loading @@ -75,6 +75,31 @@ public function testThemeConfig($theme) { * @internal */ protected function assertExtensionConfig(string $name, string $type): void { // Parse .info.yml file for module/theme $name. Since it's not installed at // this point we can't retrieve it from the 'module_handler' service. switch ($name) { case 'test_deprecated_theme': $file_name = DRUPAL_ROOT . '/core/modules/system/tests/themes/' . $name . '/' . $name . '.info.yml'; break; case 'deprecated_module': $file_name = DRUPAL_ROOT . '/core/modules/system/tests/modules/' . $name . '/' . $name . '.info.yml'; break; default; $file_name = DRUPAL_ROOT . '/core/' . $type . 's/' . $name . '/' . $name . '.info.yml'; } $info = \Drupal::service('info_parser')->parse($file_name); // Test we have a parsed info.yml file. $this->assertNotEmpty($info); // Skip deprecated extensions. if (isset($info[ExtensionLifecycle::LIFECYCLE_IDENTIFIER]) && $info[ExtensionLifecycle::LIFECYCLE_IDENTIFIER] === ExtensionLifecycle::DEPRECATED) { $this->markTestSkipped("The $type '$name' is deprecated."); } // System and user are required in order to be able to install some of the // other modules. Therefore they are put into static::$modules, which though // doesn't install config files, so import those config files explicitly. Do Loading Loading @@ -114,8 +139,11 @@ protected function assertExtensionConfig(string $name, string $type): void { /** * A data provider that lists every theme in core. * * @return array * An array of theme names to test. * Also adds a deprecated theme with config. * * @return string[][] * An array of theme names to test, with both key and value being the name * of the theme. */ public function themeListDataProvider() { $prefix = dirname(__DIR__, 4) . DIRECTORY_SEPARATOR . 'themes'; Loading @@ -128,11 +156,32 @@ public function themeListDataProvider() { // Engines is not a theme. unset($themes_keyed['engines']); // Add a deprecated theme with config. $themes_keyed['test_deprecated_theme'] = 'test_deprecated_theme'; return array_map(function ($theme) { return [$theme]; }, $themes_keyed); } /** * A data provider that lists every module in core. * * Also adds a deprecated module with config. * * @return string[][] * An array of module names to test, with both key and value being the name * of the module. */ public function moduleListDataProvider() { $modules_keyed = $this->coreModuleListDataProvider(); // Add a deprecated module with config. $modules_keyed['deprecated_module'] = ['deprecated_module']; return $modules_keyed; } /** * Tests that default config matches the installed config. * Loading Loading
core/modules/system/tests/modules/deprecated_module/config/install/deprecated_module.settings.yml 0 → 100644 +2 −0 Original line number Diff line number Diff line foo: bar
core/modules/system/tests/modules/deprecated_module/config/schema/deprecated_module.schema.yml 0 → 100644 +7 −0 Original line number Diff line number Diff line deprecated_module.settings: type: config_object label: 'deprecated_module settings' mapping: foo: type: string label: 'Wait until you meet baz!'
core/modules/system/tests/themes/test_deprecated_theme/config/install/test_deprecated_theme.settings.yml 0 → 100644 +2 −0 Original line number Diff line number Diff line favicon: use_default: true
core/modules/system/tests/themes/test_deprecated_theme/config/schema/test_deprecated_theme.schema.yml 0 → 100644 +3 −0 Original line number Diff line number Diff line test_deprecated_theme.settings: type: theme_settings label: 'test_deprecated_theme settings'
core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php +52 −3 Original line number Diff line number Diff line Loading @@ -49,7 +49,7 @@ class DefaultConfigTest extends KernelTestBase { /** * Tests if installed config is equal to the exported config. * * @dataProvider coreModuleListDataProvider * @dataProvider moduleListDataProvider */ public function testModuleConfig($module) { $this->assertExtensionConfig($module, 'module'); Loading @@ -75,6 +75,31 @@ public function testThemeConfig($theme) { * @internal */ protected function assertExtensionConfig(string $name, string $type): void { // Parse .info.yml file for module/theme $name. Since it's not installed at // this point we can't retrieve it from the 'module_handler' service. switch ($name) { case 'test_deprecated_theme': $file_name = DRUPAL_ROOT . '/core/modules/system/tests/themes/' . $name . '/' . $name . '.info.yml'; break; case 'deprecated_module': $file_name = DRUPAL_ROOT . '/core/modules/system/tests/modules/' . $name . '/' . $name . '.info.yml'; break; default; $file_name = DRUPAL_ROOT . '/core/' . $type . 's/' . $name . '/' . $name . '.info.yml'; } $info = \Drupal::service('info_parser')->parse($file_name); // Test we have a parsed info.yml file. $this->assertNotEmpty($info); // Skip deprecated extensions. if (isset($info[ExtensionLifecycle::LIFECYCLE_IDENTIFIER]) && $info[ExtensionLifecycle::LIFECYCLE_IDENTIFIER] === ExtensionLifecycle::DEPRECATED) { $this->markTestSkipped("The $type '$name' is deprecated."); } // System and user are required in order to be able to install some of the // other modules. Therefore they are put into static::$modules, which though // doesn't install config files, so import those config files explicitly. Do Loading Loading @@ -114,8 +139,11 @@ protected function assertExtensionConfig(string $name, string $type): void { /** * A data provider that lists every theme in core. * * @return array * An array of theme names to test. * Also adds a deprecated theme with config. * * @return string[][] * An array of theme names to test, with both key and value being the name * of the theme. */ public function themeListDataProvider() { $prefix = dirname(__DIR__, 4) . DIRECTORY_SEPARATOR . 'themes'; Loading @@ -128,11 +156,32 @@ public function themeListDataProvider() { // Engines is not a theme. unset($themes_keyed['engines']); // Add a deprecated theme with config. $themes_keyed['test_deprecated_theme'] = 'test_deprecated_theme'; return array_map(function ($theme) { return [$theme]; }, $themes_keyed); } /** * A data provider that lists every module in core. * * Also adds a deprecated module with config. * * @return string[][] * An array of module names to test, with both key and value being the name * of the module. */ public function moduleListDataProvider() { $modules_keyed = $this->coreModuleListDataProvider(); // Add a deprecated module with config. $modules_keyed['deprecated_module'] = ['deprecated_module']; return $modules_keyed; } /** * Tests that default config matches the installed config. * Loading