diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigSchemaTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigSchemaTest.php index b372128..e701d39 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigSchemaTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigSchemaTest.php @@ -48,7 +48,7 @@ function testSchemaMapping() { $expected['class'] = '\Drupal\Core\Config\Schema\Undefined'; $this->assertEqual($definition, $expected, 'Retrieved the right metadata for nonexistent configuration.'); - // Configuration file without schema will return Unknown as well. + // Configuration file without schema will return Undefined as well. $this->assertIdentical(FALSE, \Drupal::service('config.typed')->hasConfigSchema('config_schema_test.noschema')); $definition = \Drupal::service('config.typed')->getDefinition('config_schema_test.noschema'); $this->assertEqual($definition, $expected, 'Retrieved the right metadata for configuration with no schema.'); @@ -93,6 +93,39 @@ function testSchemaMapping() { ); $this->assertEqual($definition, $expected, 'Retrieved the right metadata for system.maintenance'); + // Mixed schema with ignore elements. + $definition = \Drupal::service('config.typed')->getDefinition('config_schema_test.ignore'); + $expected = array(); + $expected['label'] = 'Ignore test'; + $expected['class'] = '\Drupal\Core\Config\Schema\Mapping'; + $expected['mapping']['label'] = array( + 'label' => 'Label', + 'type' => 'label', + ); + $expected['mapping']['irrelevant'] = array( + 'label' => 'Irrelevant', + 'type' => 'ignore', + ); + $expected['mapping']['indescribable'] = array( + 'label' => 'Indescribable', + 'type' => 'ignore', + ); + $expected['mapping']['weight'] = array( + 'label' => 'Weight', + 'type' => 'integer', + ); + $this->assertEqual($definition, $expected, 'Retrieved the right metadata for config_schema_test.ignore'); + + // The ignore elements themselves. + $definition = \Drupal::service('config.typed')->getDefinition('config_schema_test.ignore.irrelevant'); + $expected = array(); + $expected['label'] = 'Irrelevant'; + $expected['type'] = 'ignore'; + $this->assertEqual($definition, $expected, 'Retrieved the right metadata for config_schema_test.ignore.irrelevant'); + $definition = \Drupal::service('config.typed')->getDefinition('config_schema_test.ignore.indescribable'); + $expected['label'] = 'Indescribable'; + $this->assertEqual($definition, $expected, 'Retrieved the right metadata for config_schema_test.ignore.indescribable'); + // More complex case, generic type. Metadata for image style. $definition = \Drupal::service('config.typed')->getDefinition('image.style.large'); $expected = array(); @@ -138,7 +171,7 @@ function testSchemaMapping() { $this->assertEqual($definition, $expected, 'Retrieved the right metadata for the first effect of image.style.medium'); - // More complex, multiple filesystem marker test. + // More complex, several level deep test. $definition = \Drupal::service('config.typed')->getDefinition('config_schema_test.someschema.somemodule.section_one.subsection'); // This should be the schema of config_schema_test.someschema.somemodule.*.*. $expected = array(); diff --git a/core/modules/config/tests/config_schema_test/config/install/config_schema_test.ignore.yml b/core/modules/config/tests/config_schema_test/config/install/config_schema_test.ignore.yml new file mode 100644 index 0000000..3b64ae9 --- /dev/null +++ b/core/modules/config/tests/config_schema_test/config/install/config_schema_test.ignore.yml @@ -0,0 +1,9 @@ +label: 'Label string' +irrelevant: 123 +indescribable: + abc: 789 + def: + - 456 + - 'abc' + xyz: 13.4 +weight: 27 diff --git a/core/modules/config/tests/config_schema_test/config/schema/config_schema_test.schema.yml b/core/modules/config/tests/config_schema_test/config/schema/config_schema_test.schema.yml index 9eec7d7..ce13363 100644 --- a/core/modules/config/tests/config_schema_test/config/schema/config_schema_test.schema.yml +++ b/core/modules/config/tests/config_schema_test/config/schema/config_schema_test.schema.yml @@ -132,3 +132,20 @@ config_schema_test.schema_in_install: config_schema_test_integer: type: integer label: 'Config test integer' + +config_schema_test.ignore: + type: mapping + label: 'Ignore test' + mapping: + label: + type: label + label: 'Label' + irrelevant: + type: ignore + label: 'Ignore' + indescribable: + type: ignore + label: 'Indescribable' + weight: + type: integer + label: 'Weight'