class DefaultConfigTest
Same name in this branch
- 9 core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php \Drupal\KernelTests\Config\DefaultConfigTest
- 9 core/tests/Drupal/Tests/Core/Extension/DefaultConfigTest.php \Drupal\Tests\Core\Extension\DefaultConfigTest
Same name and namespace in other branches
- 11.x core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php \Drupal\KernelTests\Config\DefaultConfigTest
- 11.x core/tests/Drupal/Tests/Core/Extension/DefaultConfigTest.php \Drupal\Tests\Core\Extension\DefaultConfigTest
- 10 core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php \Drupal\KernelTests\Config\DefaultConfigTest
- 10 core/tests/Drupal/Tests/Core/Extension/DefaultConfigTest.php \Drupal\Tests\Core\Extension\DefaultConfigTest
- 8.9.x core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php \Drupal\KernelTests\Config\DefaultConfigTest
- 8.9.x core/tests/Drupal/KernelTests/Core/Config/DefaultConfigTest.php \Drupal\KernelTests\Core\Config\DefaultConfigTest
- 8.9.x core/tests/Drupal/Tests/Core/Extension/DefaultConfigTest.php \Drupal\Tests\Core\Extension\DefaultConfigTest
Tests that default configuration provided by all modules matches schema.
@group config
Hierarchy
- class \Drupal\KernelTests\KernelTestBase extends \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertLegacyTrait, \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait implements \PHPUnit\Framework\TestCase
- class \Drupal\KernelTests\Core\Config\DefaultConfigTest uses \Drupal\Tests\SchemaCheckTestTrait implements \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of DefaultConfigTest
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Config/ DefaultConfigTest.php, line 17
Namespace
Drupal\KernelTests\Core\ConfigView source
class DefaultConfigTest extends KernelTestBase {
use SchemaCheckTestTrait;
/**
* Modules to enable.
*
* @var array
*/
protected static $modules = [
'system',
'config_test',
];
/**
* Config files to be ignored by this test.
*
* @var array
*/
protected $toSkip = [
// Skip files provided by the config_schema_test module since that module
// is explicitly for testing schema.
'config_schema_test.ignore',
'config_schema_test.noschema',
'config_schema_test.plugin_types',
'config_schema_test.someschema.somemodule.section_one.subsection',
'config_schema_test.someschema.somemodule.section_two.subsection',
'config_schema_test.someschema.with_parents',
'config_schema_test.someschema',
// Skip tour-test-legacy files as they intentionally have deprecated
// properties.
'tour.tour.tour-test-legacy',
'tour.tour.tour-test-legacy-location',
];
/**
* {@inheritdoc}
*/
public function register(ContainerBuilder $container) {
parent::register($container);
$container->register('default_config_test.schema_storage')
->setClass('\\Drupal\\config_test\\TestInstallStorage')
->addArgument(InstallStorage::CONFIG_SCHEMA_DIRECTORY);
$definition = $container->getDefinition('config.typed');
$definition->replaceArgument(1, new Reference('default_config_test.schema_storage'));
}
/**
* Tests default configuration data type.
*/
public function testDefaultConfig() {
$typed_config = \Drupal::service('config.typed');
// Create a configuration storage with access to default configuration in
// every module, profile and theme.
$default_config_storage = new TestInstallStorage();
foreach ($default_config_storage->listAll() as $config_name) {
if (in_array($config_name, $this->toSkip)) {
continue;
}
$data = $default_config_storage->read($config_name);
$this->assertConfigSchema($typed_config, $config_name, $data);
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.