function SchemaCheckTestTrait::assertConfigSchema
Same name in other branches
- 9 core/tests/Drupal/Tests/SchemaCheckTestTrait.php \Drupal\Tests\SchemaCheckTestTrait::assertConfigSchema()
- 10 core/tests/Drupal/Tests/SchemaCheckTestTrait.php \Drupal\Tests\SchemaCheckTestTrait::assertConfigSchema()
- 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.
33 calls to SchemaCheckTestTrait::assertConfigSchema()
- BlockConfigSchemaTest::testBlockConfigSchema in core/
modules/ block/ tests/ src/ Kernel/ BlockConfigSchemaTest.php - Tests the block config schema for block plugins.
- ConfigImportAllTest::testInstallUninstall in core/
modules/ config/ tests/ src/ Functional/ ConfigImportAllTest.php - Tests that a fixed set of modules can be installed and uninstalled.
- DefaultConfigTest::testDefaultConfig in core/
tests/ Drupal/ KernelTests/ Core/ Config/ DefaultConfigTest.php - Tests default configuration data type.
- EntityReferenceFieldDefaultValueTest::testEntityReferenceDefaultValue in core/
modules/ field/ tests/ src/ Functional/ EntityReference/ EntityReferenceFieldDefaultValueTest.php - Tests that default values are correctly translated to UUIDs in config.
- EntityReferenceFieldTest::testReferencedEntitiesStringId in core/
tests/ Drupal/ KernelTests/ Core/ Entity/ EntityReferenceFieldTest.php - Tests referencing entities with string IDs.
File
-
core/
tests/ Drupal/ Tests/ SchemaCheckTestTrait.php, line 26
Class
- SchemaCheckTestTrait
- Provides a class for checking configuration schema.
Namespace
Drupal\TestsCode
public function assertConfigSchema(TypedConfigManagerInterface $typed_config, $config_name, $config_data) {
$errors = $this->checkConfigSchema($typed_config, $config_name, $config_data);
if ($errors === FALSE) {
// @todo Since the use of this trait is under TestBase, it works.
// Can be fixed as part of https://www.drupal.org/node/2260053.
$this->fail(new FormattableMarkup('No schema for @config_name', [
'@config_name' => $config_name,
]));
return;
}
elseif ($errors === TRUE) {
// @todo Since the use of this trait is under TestBase, it works.
// Can be fixed as part of https://www.drupal.org/node/2260053.
$this->pass(new FormattableMarkup('Schema found for @config_name and values comply with schema.', [
'@config_name' => $config_name,
]));
}
else {
foreach ($errors as $key => $error) {
// @todo Since the use of this trait is under TestBase, it works.
// Can be fixed as part of https://www.drupal.org/node/2260053.
$this->fail(new FormattableMarkup('Schema key @key failed with: @error', [
'@key' => $key,
'@error' => $error,
]));
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.