protected function setUp(): void
{ parent::
setUp();
$this->
installConfig(['config_test', 'config_schema_test'
]);
$this->typedConfig = \Drupal::
service('config.typed'
);
} /**
* Tests \Drupal\Core\Config\Schema\SchemaCheckTrait.
*/
public function testTrait() { // Test a non existing schema.
$ret =
$this->
checkConfigSchema($this->typedConfig, 'config_schema_test.noschema',
$this->
config('config_schema_test.noschema'
)->
get());
$this->
assertFalse($ret);
// Test an existing schema with valid data.
$config_data =
$this->
config('config_test.types'
)->
get();
$ret =
$this->
checkConfigSchema($this->typedConfig, 'config_test.types',
$config_data);
$this->
assertTrue($ret);
// Add a new key, a new array and overwrite boolean with array to test the
// error messages.
$config_data =
['new_key' => 'new_value', 'new_array' =>
[]] +
$config_data;
$config_data['boolean'
] =
[];