diff --git a/core/lib/Drupal/Core/Config/Testing/ConfigSchemaChecker.php b/core/lib/Drupal/Core/Config/Testing/ConfigSchemaChecker.php index cf5f113..dbf6b7c 100644 --- a/core/lib/Drupal/Core/Config/Testing/ConfigSchemaChecker.php +++ b/core/lib/Drupal/Core/Config/Testing/ConfigSchemaChecker.php @@ -66,9 +66,20 @@ public function onConfigSave(ConfigCrudEvent $event) { $name = $saved_config->getName(); $data = $saved_config->get(); $checksum = crc32(serialize($data)); - // Content translation settings cannot be provided schema yet, see - // https://www.drupal.org/node/2363155 - if ($name != 'content_translation.settings' && !isset($this->checked[$name . ':' . $checksum])) { + $exceptions = array( + // Content translation settings cannot be provided schema yet, see + // https://www.drupal.org/node/2363155 + 'content_translation.settings', + // Following are used to test lack of or partial schema. Where partial + // schema is provided, that is explicitly tested in specific tests. + 'config_schema_test.noschema', + 'config_schema_test.someschema', + 'config_schema_test.schema_data_types', + 'config_schema_test.no_schema_data_types', + // Used to test application of schema to filtering of configuration. + 'config_test.dynamic.system', + ); + if (!in_array($name, $exceptions) && !isset($this->checked[$name . ':' . $checksum])) { $this->checked[$name . ':' . $checksum] = TRUE; $errors = $this->checkConfigSchema($this->typedManager, $name, $data); if ($errors === FALSE) { diff --git a/core/modules/config/tests/config_test/config/schema/config_test.schema.yml b/core/modules/config/tests/config_test/config/schema/config_test.schema.yml index 6b375af..5237146 100644 --- a/core/modules/config/tests/config_test/config/schema/config_test.schema.yml +++ b/core/modules/config/tests/config_test/config/schema/config_test.schema.yml @@ -105,6 +105,101 @@ config_test.system: foo: type: string label: 'Foo' + baz: + type: string + label: 'Baz' '404': type: string label: '404' + +config_test.new: + type: mapping + label: 'Configuration test' + mapping: + key: + type: string + label: 'Test setting' + new_key: + type: string + label: 'Test setting' + uuid: + type: string + label: 'UUID' + +config_test.old: + type: config_test.new + +config_test.foo: + type: mapping + label: 'Configuration test' + mapping: + value: + type: mapping + label: 'Value' + mapping: + key: + type: string + label: 'Key' + label: + type: label + label: 'Label' + +config_test.bar: + type: config_test.foo + +foo.bar: + type: mapping + mapping: + foo: + type: string + biff: + type: mapping + mapping: + bang: + type: string + array: + type: mapping + mapping: + foo: + type: string + biff: + type: mapping + mapping: + bang: + type: string + nested: + type: mapping + mapping: + array: + type: mapping + mapping: + foo: + type: string + biff: + type: mapping + mapping: + bang: + type: string + 'false': + type: boolean + 'true': + type: boolean + 'null': + type: string + casting_array: + type: mapping + mapping: + cast: + type: mapping + mapping: + 'false': + type: boolean + +foo.baz: + type: mapping + mapping: + foo: + type: string + +biff.bang: + type: foo.baz diff --git a/core/modules/config/tests/config_collection_install_test/config/schema/config_collection_install_test.schema.yml b/core/modules/config/tests/config_collection_install_test/config/schema/config_collection_install_test.schema.yml new file mode 100644 index 0000000..6e93f97 --- /dev/null +++ b/core/modules/config/tests/config_collection_install_test/config/schema/config_collection_install_test.schema.yml @@ -0,0 +1,7 @@ +config_collection_install_test.test: + type: mapping + label: 'Collection test' + mapping: + collection: + type: string + label: 'Collection' diff --git a/core/modules/config/tests/config_events_test/config/schema/config_events_test.schema.yml b/core/modules/config/tests/config_events_test/config/schema/config_events_test.schema.yml new file mode 100644 index 0000000..e3005b1 --- /dev/null +++ b/core/modules/config/tests/config_events_test/config/schema/config_events_test.schema.yml @@ -0,0 +1,7 @@ +config_events_test.test: + type: mapping + label: 'Configuration events test' + mapping: + key: + type: string + label: 'Value' diff --git a/core/modules/config/src/Tests/ConfigFileContentTest.php b/core/modules/config/src/Tests/ConfigFileContentTest.php index 5a51eaa..03cad33 100644 --- a/core/modules/config/src/Tests/ConfigFileContentTest.php +++ b/core/modules/config/src/Tests/ConfigFileContentTest.php @@ -18,6 +18,13 @@ class ConfigFileContentTest extends KernelTestBase { /** + * Modules to enable. + * + * @var array + */ + public static $modules = array('config_test'); + + /** * Set to TRUE to strict check all configuration saved. * * @see \Drupal\Core\Config\Testing\ConfigSchemaChecker