diff --git a/core/modules/aggregator/config/install/core.entity_view_display.aggregator_feed.aggregator_feed.default.yml b/core/modules/aggregator/config/install/core.entity_view_display.aggregator_feed.aggregator_feed.default.yml index 8069d3a..e3c23cf 100644 --- a/core/modules/aggregator/config/install/core.entity_view_display.aggregator_feed.aggregator_feed.default.yml +++ b/core/modules/aggregator/config/install/core.entity_view_display.aggregator_feed.aggregator_feed.default.yml @@ -29,5 +29,4 @@ content: third_party_settings: { } label: inline hidden: - langcode: true more_link: true diff --git a/core/modules/aggregator/config/install/core.entity_view_display.aggregator_feed.aggregator_feed.summary.yml b/core/modules/aggregator/config/install/core.entity_view_display.aggregator_feed.aggregator_feed.summary.yml index 164f11c..40425f2 100644 --- a/core/modules/aggregator/config/install/core.entity_view_display.aggregator_feed.aggregator_feed.summary.yml +++ b/core/modules/aggregator/config/install/core.entity_view_display.aggregator_feed.aggregator_feed.summary.yml @@ -19,5 +19,4 @@ hidden: description: true feed_icon: true image: true - langcode: true link: true diff --git a/core/modules/book/config/install/core.entity_form_display.node.book.default.yml b/core/modules/book/config/install/core.entity_form_display.node.book.default.yml index aa09049..700bd84 100644 --- a/core/modules/book/config/install/core.entity_form_display.node.book.default.yml +++ b/core/modules/book/config/install/core.entity_form_display.node.book.default.yml @@ -25,11 +25,6 @@ content: weight: 10 settings: { } third_party_settings: { } - langcode: - type: language_select - weight: 2 - settings: { } - third_party_settings: { } path: type: path weight: 30 diff --git a/core/modules/book/config/install/core.entity_view_display.node.book.default.yml b/core/modules/book/config/install/core.entity_view_display.node.book.default.yml index 7d8f5b6..729516e 100644 --- a/core/modules/book/config/install/core.entity_view_display.node.book.default.yml +++ b/core/modules/book/config/install/core.entity_view_display.node.book.default.yml @@ -20,5 +20,4 @@ content: third_party_settings: { } links: weight: 101 -hidden: - langcode: true +hidden: { } diff --git a/core/modules/book/config/install/core.entity_view_display.node.book.teaser.yml b/core/modules/book/config/install/core.entity_view_display.node.book.teaser.yml index 9f2988e..fb22db6 100644 --- a/core/modules/book/config/install/core.entity_view_display.node.book.teaser.yml +++ b/core/modules/book/config/install/core.entity_view_display.node.book.teaser.yml @@ -22,5 +22,4 @@ content: third_party_settings: { } links: weight: 101 -hidden: - langcode: true +hidden: { } diff --git a/core/modules/forum/config/install/core.entity_form_display.comment.comment_forum.default.yml b/core/modules/forum/config/install/core.entity_form_display.comment.comment_forum.default.yml index eeb583c..a09c30b 100644 --- a/core/modules/forum/config/install/core.entity_form_display.comment.comment_forum.default.yml +++ b/core/modules/forum/config/install/core.entity_form_display.comment.comment_forum.default.yml @@ -20,11 +20,6 @@ content: rows: 5 placeholder: '' third_party_settings: { } - langcode: - type: language_select - weight: 2 - settings: { } - third_party_settings: { } subject: type: string_textfield weight: 10 diff --git a/core/modules/forum/config/install/core.entity_form_display.node.forum.default.yml b/core/modules/forum/config/install/core.entity_form_display.node.forum.default.yml index 1ac7c6c..98e5bf1 100644 --- a/core/modules/forum/config/install/core.entity_form_display.node.forum.default.yml +++ b/core/modules/forum/config/install/core.entity_form_display.node.forum.default.yml @@ -33,11 +33,6 @@ content: weight: 10 settings: { } third_party_settings: { } - langcode: - type: language_select - weight: 2 - settings: { } - third_party_settings: { } path: type: path weight: 30 diff --git a/core/modules/forum/config/install/core.entity_form_display.taxonomy_term.forums.default.yml b/core/modules/forum/config/install/core.entity_form_display.taxonomy_term.forums.default.yml index 752adf8..3b8fdd4 100644 --- a/core/modules/forum/config/install/core.entity_form_display.taxonomy_term.forums.default.yml +++ b/core/modules/forum/config/install/core.entity_form_display.taxonomy_term.forums.default.yml @@ -15,11 +15,6 @@ content: weight: 0 settings: { } third_party_settings: { } - langcode: - type: language_select - weight: 2 - settings: { } - third_party_settings: { } name: type: string_textfield weight: -5 diff --git a/core/modules/forum/config/install/core.entity_view_display.comment.comment_forum.default.yml b/core/modules/forum/config/install/core.entity_view_display.comment.comment_forum.default.yml index 8dbbdbd..f4f0112 100644 --- a/core/modules/forum/config/install/core.entity_view_display.comment.comment_forum.default.yml +++ b/core/modules/forum/config/install/core.entity_view_display.comment.comment_forum.default.yml @@ -19,5 +19,4 @@ content: third_party_settings: { } links: weight: 100 -hidden: - langcode: true +hidden: { } diff --git a/core/modules/forum/config/install/core.entity_view_display.node.forum.default.yml b/core/modules/forum/config/install/core.entity_view_display.node.forum.default.yml index 8ccf000..69fdb79 100644 --- a/core/modules/forum/config/install/core.entity_view_display.node.forum.default.yml +++ b/core/modules/forum/config/install/core.entity_view_display.node.forum.default.yml @@ -38,5 +38,4 @@ content: settings: link: true third_party_settings: { } -hidden: - langcode: true +hidden: { } diff --git a/core/modules/forum/config/install/core.entity_view_display.node.forum.teaser.yml b/core/modules/forum/config/install/core.entity_view_display.node.forum.teaser.yml index 548993d..6eb1a0c 100644 --- a/core/modules/forum/config/install/core.entity_view_display.node.forum.teaser.yml +++ b/core/modules/forum/config/install/core.entity_view_display.node.forum.teaser.yml @@ -34,4 +34,3 @@ content: third_party_settings: { } hidden: comment_forum: true - langcode: true diff --git a/core/modules/forum/config/install/core.entity_view_display.taxonomy_term.forums.default.yml b/core/modules/forum/config/install/core.entity_view_display.taxonomy_term.forums.default.yml index b3db127..07b131a 100644 --- a/core/modules/forum/config/install/core.entity_view_display.taxonomy_term.forums.default.yml +++ b/core/modules/forum/config/install/core.entity_view_display.taxonomy_term.forums.default.yml @@ -17,5 +17,4 @@ content: third_party_settings: { } label: above hidden: - langcode: true forum_container: true diff --git a/core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php b/core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php new file mode 100644 index 0000000..9bbcb67 --- /dev/null +++ b/core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php @@ -0,0 +1,197 @@ +root)); + + parent::setUp(); + + // @todo ModuleInstaller calls system_rebuild_module_data which is part of + // system.module, see https://www.drupal.org/node/2208429. + include_once $this->root . '/core/modules/system/system.module'; + + // Set up the state values so we know where to find the files when running + // drupal_get_filename(). + // @todo Remove as part of https://www.drupal.org/node/2186491 + system_rebuild_module_data(); + + $this->installSchema('system', 'router'); + } + + /** + * @dataProvider providerTestModuleConfig + */ + public function testModuleConfig($module) { + /** @var \Drupal\Core\Extension\ModuleInstallerInterface $module_installer */ + $module_installer = $this->container->get('module_installer'); + /** @var \Drupal\Core\Config\StorageInterface $active_config_storage */ + $active_config_storage = $this->container->get('config.storage'); + /** @var \Drupal\Core\Config\ConfigManagerInterface $config_manager */ + $config_manager = $this->container->get('config.manager'); + + $module_installer->install([$module]); + + $default_install_path = drupal_get_path('module', $module) . '/' . InstallStorage::CONFIG_INSTALL_DIRECTORY; + $module_config_storage = new FileStorage($default_install_path, StorageInterface::DEFAULT_COLLECTION); + + // The following config entries are changed on module install, so compare + // it doesn't make sense. + $skipped_config = []; + $skipped_config['locale.settings'][] = 'path: '; + $skipped_config['syslog.settings'][] = 'facility: '; + + // Compare the installed config with the one in the module directory. + foreach ($module_config_storage->listAll() as $config_name) { + $result = $config_manager->diff($module_config_storage, $active_config_storage, $config_name); + foreach ($result->getEdits() as $op) { + switch (get_class($op)) { + case 'Drupal\Component\Diff\Engine\DiffOpCopy': + // Nothing to do, a copy is what we expect. + break; + case 'Drupal\Component\Diff\Engine\DiffOpChange': + // Its not part of the skipped config, so we can directly throw the + // exception. + if (!in_array($config_name, array_keys($skipped_config))) { + throw new \Exception($config_name . ': ' . var_export($op, TRUE)); + } + // Ensure that the only changed lines are the ones we marked as + // skipped. + $all_skipped = TRUE; + + foreach ($op->closing as $closing) { + // Skip some of the changes, as they are caused by module install + // code. + $found = FALSE; + if (!empty($skipped_config[$config_name])) { + foreach ($skipped_config[$config_name] as $line) { + if (strpos($closing, $line) !== FALSE) { + $found = TRUE; + break; + } + } + } + $all_skipped = $all_skipped && $found; + } + + if (!$all_skipped) { + throw new \Exception($config_name . ': ' . var_export($op, TRUE)); + } + break; + case 'Drupal\Component\Diff\Engine\DiffOpAdd': + foreach ($op->closing as $closing) { + if (strpos($closing, 'uuid: ') === 0) { + continue; + } + throw new \Exception($config_name . ': ' . var_export($op, TRUE)); + } + break; + default: + throw new \Exception($config_name . ': ' . var_export($op, TRUE)); + break; + } + } + } + + print_r($module . "\n"); + } + + public function providerTestModuleConfig() { + $data = []; + + $data[] = ['action']; + $data[] = ['field']; + $data[] = ['rdf']; + $data[] = ['aggregator']; + $data[] = ['field_ui']; + $data[] = ['responsive_image']; + $data[] = ['ban']; + $data[] = ['file']; + $data[] = ['rest']; + $data[] = ['basic_auth']; + $data[] = ['filter']; + $data[] = ['search']; + $data[] = ['block']; + $data[] = ['forum']; + $data[] = ['serialization']; + $data[] = ['block_content']; + $data[] = ['hal']; + $data[] = ['shortcut']; + $data[] = ['book']; + $data[] = ['help']; + # $data[] = ['simpletest']; + $data[] = ['breakpoint']; + $data[] = ['history']; + $data[] = ['statistics']; + $data[] = ['ckeditor']; + $data[] = ['image']; + $data[] = ['syslog']; + $data[] = ['color']; + $data[] = ['language']; + $data[] = ['system']; + $data[] = ['comment']; + $data[] = ['link']; + $data[] = ['taxonomy']; + $data[] = ['config']; + $data[] = ['locale']; + $data[] = ['telephone']; + $data[] = ['config_translation']; + $data[] = ['menu_link_content']; + $data[] = ['text']; + $data[] = ['contact']; + $data[] = ['menu_ui']; + $data[] = ['toolbar']; + $data[] = ['content_translation']; + $data[] = ['migrate']; + $data[] = ['tour']; + $data[] = ['contextual']; + $data[] = ['migrate_drupal']; + $data[] = ['tracker']; + $data[] = ['datetime']; + $data[] = ['node']; + $data[] = ['update']; + $data[] = ['dblog']; + $data[] = ['options']; + # $data[] = ['user']; + $data[] = ['dynamic_page_cache']; + $data[] = ['page_cache']; + $data[] = ['views']; + $data[] = ['editor']; + $data[] = ['path']; + $data[] = ['views_ui']; + $data[] = ['entity_reference']; + $data[] = ['quickedit']; + + return $data; + } + +}