function SchemaCheckTestTrait::assertConfigSchema
Same name and namespace in other branches
- 11.x core/tests/Drupal/Tests/SchemaCheckTestTrait.php \Drupal\Tests\SchemaCheckTestTrait::assertConfigSchema()
Asserts the TypedConfigManager has a valid schema for the configuration.
Parameters
\Drupal\Core\Config\TypedConfigManagerInterface $typed_config: The TypedConfigManager.
string $config_name: The configuration name.
array $config_data: The configuration data.
11 calls to SchemaCheckTestTrait::assertConfigSchema()
- EntityReferenceFieldDefaultValueTest::testEntityReferenceDefaultValue in core/
modules/ field/ tests/ src/ Functional/ EntityReference/ EntityReferenceFieldDefaultValueTest.php - Tests that default values are correctly translated to UUIDs in config.
- LanguageConfigSchemaTest::testValidLanguageConfigSchema in core/
modules/ language/ tests/ src/ Functional/ LanguageConfigSchemaTest.php - Tests whether the language config schema is valid.
- MigrateDblogConfigsTest::testDblogSettings in core/
modules/ dblog/ tests/ src/ Kernel/ Migrate/ d6/ MigrateDblogConfigsTest.php - Tests migration of dblog variables to dblog.settings.yml.
- MigrateFileConfigsTest::testFileSettings in core/
modules/ file/ tests/ src/ Kernel/ Migrate/ d6/ MigrateFileConfigsTest.php - Tests migration of file variables to file.settings.yml.
- MigrateFileConfigsTest::testFileSettings in core/
modules/ file/ tests/ src/ Kernel/ Migrate/ d7/ MigrateFileConfigsTest.php - Tests migration of file variables to file.settings.yml.
File
-
core/
tests/ Drupal/ Tests/ SchemaCheckTestTrait.php, line 25
Class
- SchemaCheckTestTrait
- Provides a class for checking configuration schema.
Namespace
Drupal\TestsCode
public function assertConfigSchema(TypedConfigManagerInterface $typed_config, $config_name, $config_data) {
$check = $this->checkConfigSchema($typed_config, $config_name, $config_data);
$message = '';
if ($check === FALSE) {
$message = 'Error: No schema exists.';
}
elseif ($check !== TRUE) {
$this->assertIsArray($check, "The config schema check errors should be in the form of an array.");
$message = "Errors:\n";
foreach ($check as $key => $error) {
$message .= "Schema key {$key} failed with: {$error}\n";
}
}
$this->assertTrue($check, "There should be no errors in configuration '{$config_name}'. {$message}");
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.