diff --git a/core/modules/breakpoint/config/schema/breakpoint.schema.yml b/core/modules/breakpoint/config/schema/breakpoint.schema.yml index 6281da7..0e90f7c 100644 --- a/core/modules/breakpoint/config/schema/breakpoint.schema.yml +++ b/core/modules/breakpoint/config/schema/breakpoint.schema.yml @@ -25,7 +25,7 @@ breakpoint.breakpoint.*.*.*: type: string label: 'Source type' weight: - type: string + type: integer label: 'Weight' multipliers: type: sequence diff --git a/core/modules/config/lib/Drupal/config/Tests/DefaultConfigTest.php b/core/modules/config/lib/Drupal/config/Tests/DefaultConfigTest.php new file mode 100644 index 0000000..509325b --- /dev/null +++ b/core/modules/config/lib/Drupal/config/Tests/DefaultConfigTest.php @@ -0,0 +1,132 @@ + 'Default configuration', + 'description' => 'Tests that default configuration provided by all modules matches schema.', + 'group' => 'Configuration', + ); + } + + public function testDefaultConfig() { + /** @var \Drupal\Core\Config\TypedConfigManager $typed_config */ + $typed_config = $this->container->get('config.typed'); + + $default_config_storage = new InstallStorage(); + foreach ($default_config_storage->listAll() as $config_name) { + $this->configName = $config_name; + $data = $default_config_storage->read($config_name); + if (!$typed_config->hasConfigSchema($config_name)) { + $this->fail(String::format('No schema for !config_name', array('!config_name' => $config_name))); + continue; + } + $definition = $typed_config->getDefinition($config_name); + $this->schema = $typed_config->create($definition, $data); + $this->configPass = TRUE; + foreach ($data as $key => $value) { + $this->checkValue($key, $value); + } + if ($this->configPass) { + $this->pass(String::format('Schema found for !config_name and values comply with schema.', array('!config_name' => $config_name))); + } + } + } + + protected function checkValue($key, $value) { + if (is_scalar($value) || $value === NULL) { + try { + $success = FALSE; + $type = gettype($value); + $element = $this->schema->get($key); + if ($element instanceof PrimitiveInterface) { + if ($type == 'integer' && $element instanceof IntegerInterface) { + $success = TRUE; + } + if ($type == 'double' && $element instanceof FloatInterface) { + $success = TRUE; + } + if ($type == 'boolean' && $element instanceof BooleanInterface) { + $success = TRUE; + } + if ($type == 'string' && ($element instanceof StringInterface || $element instanceof Property)) { + $success = TRUE; + } + } + else { + // Hmmm? + } + $class = get_class($element); + if (!$success) { + $this->fail("{$this->configName}:$key has the wrong schema. Variable type is $type and schema class is $class."); + } + //else { + // $this->pass("{$this->configName}:$key has the correct schema. Variable type is $type and schema class is $class."); + //} + + } + catch (SchemaIncompleteException $e) { + $this->fail("{$this->configName}:$key has no schema."); + } + } + else { + // Any non-scalar value must be an array. + if (!is_array($value)) { + $value = (array) $value; + } + // Recurse into any nested keys. + foreach ($value as $nested_value_key => $nested_value) { + $value[$nested_value_key] = $this->checkValue($key . '.' . $nested_value_key, $nested_value); + } + } + return $value; + } + + protected function fail($message = NULL, $group = 'Other') { + $this->configPass = FALSE; + return parent::fail($message, $group); + } + +} diff --git a/core/modules/views/config/schema/views.data_types.schema.yml b/core/modules/views/config/schema/views.data_types.schema.yml index 4c10048..26d20e6 100644 --- a/core/modules/views/config/schema/views.data_types.schema.yml +++ b/core/modules/views/config/schema/views.data_types.schema.yml @@ -211,6 +211,9 @@ views_sort: plugin_id: type: string label: 'Plugin ID' + provider: + type: string + label: 'Provider' views_area: type: views_handler diff --git a/core/modules/views/config/schema/views.schema.yml b/core/modules/views/config/schema/views.schema.yml index 66713b5..a9a7eaf 100644 --- a/core/modules/views/config/schema/views.schema.yml +++ b/core/modules/views/config/schema/views.schema.yml @@ -72,12 +72,15 @@ views.view.*: type: mapping label: 'View' mapping: + langcode: + type: string + label: 'Default language' status: type: boolean label: 'Status' module: label: 'Module' - name: + id: label: 'Machine name' description: type: text diff --git a/core/profiles/minimal/config/block.block.stark_admin.yml b/core/profiles/minimal/config/block.block.stark_admin.yml index 1c11ab5..aeded26 100644 --- a/core/profiles/minimal/config/block.block.stark_admin.yml +++ b/core/profiles/minimal/config/block.block.stark_admin.yml @@ -1,7 +1,7 @@ id: stark_admin theme: stark -weight: '1' -status: '1' +weight: 1 +status: true langcode: en region: sidebar_first plugin: 'system_menu_block:admin' @@ -9,10 +9,10 @@ settings: label: Administration module: system label_display: visible - cache: '-1' + cache: -1 visibility: path: - visibility: '0' + visibility: 0 pages: '' role: roles: { } diff --git a/core/profiles/minimal/config/block.block.stark_login.yml b/core/profiles/minimal/config/block.block.stark_login.yml index a727ff5..7ca1d45 100644 --- a/core/profiles/minimal/config/block.block.stark_login.yml +++ b/core/profiles/minimal/config/block.block.stark_login.yml @@ -1,7 +1,7 @@ id: stark_login theme: stark -weight: '0' -status: '1' +weight: 0 +status: true langcode: en region: sidebar_first plugin: user_login_block @@ -9,10 +9,10 @@ settings: label: 'User login' module: user label_display: visible - cache: '-1' + cache: -1 visibility: path: - visibility: '0' + visibility: 0 pages: '' role: roles: { } diff --git a/core/profiles/minimal/config/block.block.stark_tools.yml b/core/profiles/minimal/config/block.block.stark_tools.yml index 6073ede..0d1fb7b 100644 --- a/core/profiles/minimal/config/block.block.stark_tools.yml +++ b/core/profiles/minimal/config/block.block.stark_tools.yml @@ -1,7 +1,7 @@ id: stark_tools theme: stark -weight: '0' -status: '1' +weight: 0 +status: true langcode: en region: sidebar_first plugin: 'system_menu_block:tools' @@ -9,10 +9,10 @@ settings: label: Tools module: system label_display: visible - cache: '-1' + cache: -1 visibility: path: - visibility: '0' + visibility: 0 pages: '' role: roles: { }