$expected['mapping'
]['langcode'
]['label'
] = 'Language code';
$expected['mapping'
]['_core'
]['type'
] = '_core_config_info';
$expected['mapping'
]['testitem'
] =
['label' => 'Test item'
];
$expected['mapping'
]['testlist'
] =
['label' => 'Test list'
];
$expected['type'
] = 'config_schema_test.someschema';
$expected['definition_class'
] = '\Drupal\Core\TypedData\MapDataDefinition';
$expected['unwrap_for_canonical_representation'
] = TRUE;
$this->
assertEquals($expected,
$definition, 'Retrieved the right metadata for configuration with only some schema.'
);
// Check type detection on elements with undefined types.
$config = \Drupal::
service('config.typed'
)->
get('config_schema_test.someschema'
);
$definition =
$config->
get('testitem'
)->
getDataDefinition()->
toArray();
$expected =
[];
$expected['label'
] = 'Test item';
$expected['class'
] = Undefined::
class;
$expected['type'
] = 'undefined';
$expected['definition_class'
] = '\Drupal\Core\TypedData\DataDefinition';
$expected['unwrap_for_canonical_representation'
] = TRUE;
$this->
assertEquals($expected,
$definition, 'Automatic type detected for a scalar is undefined.'
);
$definition =
$config->
get('testlist'
)->
getDataDefinition()->
toArray();
$expected =
[];
$expected['label'
] = 'Test list';
$expected['class'
] = Undefined::
class;