f9aa67342104c28522011d0ba6e9948d51000713
[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     );
39
40     // Create a configuration storage with access to default configuration in
41     // every module, profile and theme.
42     $default_config_storage = new TestInstallStorage('test_views');
43
44     foreach ($default_config_storage->listAll() as $config_name) {
45       // Skip files provided by the config_schema_test module since that module
46       // is explicitly for testing schema.
47       if (strpos($config_name, 'config_schema_test') === 0) {
48         continue;
49       }
50
51       $data = $default_config_storage->read($config_name);
52       $this->assertConfigSchema($typed_config, $config_name, $data);
53     }
54   }
55
56 }