dcd1859be34595eb1779ca4909c802a6535431ce
[yaffs-website] / web / core / modules / views / tests / src / Kernel / TestViewsTest.php
1 <?php
2
3 namespace Drupal\Tests\views\Kernel;
4
5 use Drupal\Tests\SchemaCheckTestTrait;
6 use Drupal\config_test\TestInstallStorage;
7 use Drupal\Core\Config\InstallStorage;
8 use Drupal\Core\Config\TypedConfigManager;
9 use Drupal\KernelTests\KernelTestBase;
10
11 /**
12  * Tests that test views provided by all modules match schema.
13  *
14  * @group config
15  */
16 class TestViewsTest extends KernelTestBase {
17
18   use SchemaCheckTestTrait;
19
20   /**
21    * Modules to enable.
22    *
23    * @var array
24    */
25   public static $modules = ['views_test_data'];
26
27   /**
28    * Tests default configuration data type.
29    */
30   public function testDefaultConfig() {
31     // Create a typed config manager with access to configuration schema in
32     // every module, profile and theme.
33     $typed_config = new TypedConfigManager(
34       \Drupal::service('config.storage'),
35       new TestInstallStorage(InstallStorage::CONFIG_SCHEMA_DIRECTORY),
36       \Drupal::service('cache.discovery'),
37       \Drupal::service('module_handler'),
38       \Drupal::service('class_resolver')
39     );
40
41     // Create a configuration storage with access to default configuration in
42     // every module, profile and theme.
43     $default_config_storage = new TestInstallStorage('test_views');
44
45     foreach ($default_config_storage->listAll() as $config_name) {
46       // Skip files provided by the config_schema_test module since that module
47       // is explicitly for testing schema.
48       if (strpos($config_name, 'config_schema_test') === 0) {
49         continue;
50       }
51
52       $data = $default_config_storage->read($config_name);
53       $this->assertConfigSchema($typed_config, $config_name, $data);
54     }
55   }
56
57 }