diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigSchemaTestBase.php b/core/modules/config/lib/Drupal/config/Tests/ConfigSchemaTestBase.php index 61eee7e..b31551a 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigSchemaTestBase.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigSchemaTestBase.php @@ -2,11 +2,12 @@ /** * @file - * Contains Drupal\config\Tests\DefaultConfigTest. + * Contains Drupal\config\Tests\ConfigSchemaTestBase. */ namespace Drupal\config\Tests; +use Drupal\Core\Config\Schema\ArrayElement; use Drupal\Core\Config\Schema\Property; use Drupal\Core\Config\TypedConfigManagerInterface; use Drupal\Core\TypedData\Type\BooleanInterface; @@ -38,22 +39,13 @@ protected $configName; /** + * Global state for whether the config has a valid schema. + * * @var boolean */ protected $configPass; /** - * {@inheritdoc} - */ - public static function getInfo() { - return array( - 'name' => 'Default configuration', - 'description' => 'Tests that default configuration provided by all modules matches schema.', - 'group' => 'Configuration', - ); - } - - /** * Asserts the TypedConfigManager has a valid schema for the configuration. * * @param \Drupal\Core\Config\TypedConfigManagerInterface $typed_config @@ -92,44 +84,46 @@ public function assertConfigSchema(TypedConfigManagerInterface $typed_config, $c * Returns mixed value. */ protected function checkValue($key, $value) { + + try { + $element = $this->schema->get($key); + } + catch (SchemaIncompleteException $e) { + $this->fail("{$this->configName}:$key has no schema."); + } 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; - } - // Null values are allowed for all types. - if ($value === NULL) { - $success = TRUE; - } + $success = FALSE; + $type = gettype($value); + if ($element instanceof PrimitiveInterface) { + if ($type == 'integer' && $element instanceof IntegerInterface) { + $success = TRUE; } - else { - // @todo throw an exception due to an incomplete schema. Only possible - // once https://drupal.org/node/1910624 is complete. + if ($type == 'double' && $element instanceof FloatInterface) { + $success = TRUE; } - $class = get_class($element); - if (!$success) { - $this->fail("{$this->configName}:$key has the wrong schema. Variable type is $type and schema class is $class."); + if ($type == 'boolean' && $element instanceof BooleanInterface) { + $success = TRUE; + } + if ($type == 'string' && ($element instanceof StringInterface || $element instanceof Property)) { + $success = TRUE; + } + // Null values are allowed for all scalar types. + if ($value === NULL) { + $success = TRUE; } } - catch (SchemaIncompleteException $e) { - $this->fail("{$this->configName}:$key has no schema."); + if (!$success) { + $class = get_class($element); + $this->fail("{$this->configName}:$key has the wrong schema. Variable type is $type and schema class is $class."); } } else { - // Any non-scalar value must be an array. + if (!$element instanceof ArrayElement) { + $this->fail("Non-scalar {$this->configName}:$key is not defined as an array type (such as mapping or sequence)."); + } + + // Go on processing so we can get errors on all levels. Any non-scalar + // value must be an array so cast to an array. if (!is_array($value)) { $value = (array) $value; } diff --git a/core/modules/entity/config/schema/entity.schema.yml b/core/modules/entity/config/schema/entity.schema.yml index a6c87f0..0fc9af7 100644 --- a/core/modules/entity/config/schema/entity.schema.yml +++ b/core/modules/entity/config/schema/entity.schema.yml @@ -127,6 +127,12 @@ entity.form_display.*.*.*: dependencies: type: config_dependencies label: 'Dependencies' + hidden: + type: sequence + label: 'Hidden' + sequence: + - type: boolean + label: 'Component' # Default schema for entity display field with undefined type. entity_view_display.field.*: diff --git a/core/modules/image/config/schema/image.schema.yml b/core/modules/image/config/schema/image.schema.yml index 7545c12..5b642b3 100644 --- a/core/modules/image/config/schema/image.schema.yml +++ b/core/modules/image/config/schema/image.schema.yml @@ -126,6 +126,29 @@ field.image.instance_settings: type: field_default_image label: 'Default value' +field.image.value: + type: sequence + label: 'Default value' + sequence: + - type: mapping + label: 'Default image' + mapping: + fid: + type: integer + label: 'File ID' + alt: + type: string + label: 'Alternate text' + title: + type: string + label: 'Title text' + width: + type: integer + label: 'Width' + height: + type: integer + label: 'Height' + entity_view_display.field.image: type: entity_field_view_display_base label: 'Image field display format settings' diff --git a/core/modules/update/tests/modules/update_test/config/schema/update_test.schema.yml b/core/modules/update/tests/modules/update_test/config/schema/update_test.schema.yml index cbe32d4..2235f2b 100644 --- a/core/modules/update/tests/modules/update_test/config/schema/update_test.schema.yml +++ b/core/modules/update/tests/modules/update_test/config/schema/update_test.schema.yml @@ -5,19 +5,19 @@ update_test.settings: label: 'Update test settings' mapping: system_info: - type: seqeuence + type: sequence label: 'System info' sequence: - type: string label: 'Value' update_status: - type: seqeuence + type: sequence label: 'Update status' sequence: - type: string label: 'Value' xml_map: - type: seqeuence + type: sequence label: 'XML map' sequence: - type: string diff --git a/core/modules/user/config/schema/user.schema.yml b/core/modules/user/config/schema/user.schema.yml index 7f61921..7361704 100644 --- a/core/modules/user/config/schema/user.schema.yml +++ b/core/modules/user/config/schema/user.schema.yml @@ -171,3 +171,9 @@ action.configuration.user_remove_role_action: action.configuration.user_unblock_user_action: type: action_configuration_default label: 'Unblock the selected users configuration' + +search.plugin.user_search: + type: sequence + label: 'User search' + sequence: + - type: undefined diff --git a/core/modules/views/config/schema/views.argument_validator.schema.yml b/core/modules/views/config/schema/views.argument_validator.schema.yml index 3dbc9d7..6e3cb44 100644 --- a/core/modules/views/config/schema/views.argument_validator.schema.yml +++ b/core/modules/views/config/schema/views.argument_validator.schema.yml @@ -22,8 +22,11 @@ views.argument_validator_entity: type: mapping mapping: bundles: - type: boolean + type: sequence label: 'Bundles' + sequence: + - type: string + label: 'Bundle' access: type: boolean label: 'Access' diff --git a/core/modules/views/config/schema/views.cache.schema.yml b/core/modules/views/config/schema/views.cache.schema.yml index 1139df6..3e90332 100644 --- a/core/modules/views/config/schema/views.cache.schema.yml +++ b/core/modules/views/config/schema/views.cache.schema.yml @@ -1,20 +1,29 @@ # Schema for the views cache. views.cache.none: - type: mapping - label: 'None' + type: views_cache + label: 'No caching' mapping: - type: - type: string - label: 'Cache type' + options: + type: sequence + label: 'Options' + sequence: + - type: undefined + +views.cache.tag: + type: views_cache + label: 'Tag based caching' + mapping: + options: + type: sequence + label: 'Options' + sequence: + - type: undefined views.cache.time: - type: mapping - label: 'None' + type: views_cache + label: 'Time based caching' mapping: - type: - type: string - label: 'Time-based' options: type: mapping label: 'Cache options' 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 efbf369..9e8e12f 100644 --- a/core/modules/views/config/schema/views.data_types.schema.yml +++ b/core/modules/views/config/schema/views.data_types.schema.yml @@ -49,12 +49,6 @@ views_display: label: 'Provider' cache: type: views.cache.[type] - label: 'Caching' - mapping: - type: - label: 'Cache type' - provider: - label: 'Provider' empty: type: sequence label: 'No results behavior' @@ -852,3 +846,14 @@ views_entity_row: view_mode: type: string label: 'View mode' + +views_cache: + type: mapping + label: 'Cache configuration' + mapping: + type: + type: string + label: 'Cache type' + provider: + type: string + label: 'Provider' diff --git a/core/profiles/standard/config/install/field.instance.node.article.field_tags.yml b/core/profiles/standard/config/install/field.instance.node.article.field_tags.yml index 18b58c2..369306a 100644 --- a/core/profiles/standard/config/install/field.instance.node.article.field_tags.yml +++ b/core/profiles/standard/config/install/field.instance.node.article.field_tags.yml @@ -2,6 +2,7 @@ id: node.article.field_tags entity_type: node bundle: article field_name: field_tags +field_type: taxonomy_term_reference label: Tags description: 'Enter a comma-separated list. For example: Amsterdam, Mexico City, "Cleveland, Ohio"' required: false