public function testSchemaData() { // Try a simple property.
$meta = \Drupal::
service('config.typed'
)->
get('system.site'
);
$property =
$meta->
get('page'
)->
get('front'
);
$this->
assertInstanceOf(StringInterface::
class,
$property);
$this->
assertEquals('/user/login',
$property->
getValue(), 'Got the right value for page.front data.'
);
$definition =
$property->
getDataDefinition();
$this->
assertEmpty($definition['translatable'
], 'Got the right translatability setting for page.front data.'
);
// Check nested array of properties.
$list =
$meta->
get('page'
)->
getElements();
$this->
assertCount(3,
$list, 'Got a list with the right number of properties for site page data'
);
$this->
assertArrayHasKey('front',
$list);
$this->
assertArrayHasKey('403',
$list);
$this->
assertArrayHasKey('404',
$list);
$this->
assertEquals('/user/login',
$list['front'
]->
getValue(), 'Got the right value for page.front data from the list.'
);
// And test some TypedConfigInterface methods.
$properties =
$list;
$this->
assertCount(3,
$properties, 'Got the right number of properties for site page.'
);
$this->
assertSame($list['front'
],
$properties['front'
]);
$values =
$meta->
get('page'
)->
toArray();