protected function setUp(): void
{ parent::
setUp();
$this->
installConfig(['system', 'image', 'config_schema_test'
]);
} /**
* Tests the basic metadata retrieval layer.
*/
public function testSchemaMapping() { // Nonexistent configuration key will have Undefined as metadata.
$this->
assertFalse(\Drupal::
service('config.typed'
)->
hasConfigSchema('config_schema_test.no_such_key'
));
$definition = \Drupal::
service('config.typed'
)->
getDefinition('config_schema_test.no_such_key'
);
$expected =
[];
$expected['label'
] = 'Undefined';
$expected['class'
] = Undefined::
class;
$expected['type'
] = 'undefined';
$expected['definition_class'
] = '\Drupal\Core\TypedData\DataDefinition';
$expected['unwrap_for_canonical_representation'
] = TRUE;
$this->
assertEquals($expected,
$definition, 'Retrieved the right metadata for nonexistent configuration.'
);
// Configuration file without schema will return Undefined as well.
$this->
assertFalse(\Drupal::
service('config.typed'
)->
hasConfigSchema('config_schema_test.noschema'
));