function TestViewsTest::testDefaultConfig

Same name and namespace in other branches
  1. 9 core/modules/views/tests/src/Kernel/TestViewsTest.php \Drupal\Tests\views\Kernel\TestViewsTest::testDefaultConfig()
  2. 8.9.x core/modules/views/tests/src/Kernel/TestViewsTest.php \Drupal\Tests\views\Kernel\TestViewsTest::testDefaultConfig()
  3. 11.x core/modules/views/tests/src/Kernel/TestViewsTest.php \Drupal\Tests\views\Kernel\TestViewsTest::testDefaultConfig()

Tests default configuration data type.

File

core/modules/views/tests/src/Kernel/TestViewsTest.php, line 201

Class

TestViewsTest
Tests that test views provided by all modules match schema.

Namespace

Drupal\Tests\views\Kernel

Code

public function testDefaultConfig() : void {
  // Create a typed config manager with access to configuration schema in
  // every module, profile and theme.
  $typed_config = new TypedConfigManager(\Drupal::service('config.storage'), new TestInstallStorage(InstallStorage::CONFIG_SCHEMA_DIRECTORY), \Drupal::service('cache.discovery'), \Drupal::service('module_handler'), \Drupal::service('class_resolver'));
  $typed_config->setValidationConstraintManager(\Drupal::service('validation.constraint'));
  // Avoid restricting to the config schemas discovered.
  $this->container
    ->get('cache.discovery')
    ->delete('typed_config_definitions');
  // Create a configuration storage with access to default configuration in
  // every module, profile and theme.
  $default_config_storage = new TestInstallStorage('test_views');
  foreach ($default_config_storage->listAll() as $config_name) {
    // Skip files provided by the config_schema_test module since that module
    // is explicitly for testing schema.
    if (str_starts_with($config_name, 'config_schema_test')) {
      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.