You are here

protected function DemoUmamiProfileTest::assertDefaultConfig in Drupal 9

Same name and namespace in other branches
  1. 8 core/profiles/demo_umami/tests/src/Functional/DemoUmamiProfileTest.php \Drupal\Tests\demo_umami\Functional\DemoUmamiProfileTest::assertDefaultConfig()

Asserts that the default configuration matches active configuration.

Parameters

\Drupal\Core\Config\StorageInterface $default_config_storage: The default configuration storage to check.

\Drupal\Core\Config\StorageInterface $active_config_storage: The active configuration storage.

1 call to DemoUmamiProfileTest::assertDefaultConfig()
DemoUmamiProfileTest::testConfig in core/profiles/demo_umami/tests/src/Functional/DemoUmamiProfileTest.php
Tests the profile supplied configuration is the same after installation.

File

core/profiles/demo_umami/tests/src/Functional/DemoUmamiProfileTest.php, line 70

Class

DemoUmamiProfileTest
Tests demo_umami profile.

Namespace

Drupal\Tests\demo_umami\Functional

Code

protected function assertDefaultConfig(StorageInterface $default_config_storage, StorageInterface $active_config_storage) {

  /** @var \Drupal\Core\Config\ConfigManagerInterface $config_manager */
  $config_manager = $this->container
    ->get('config.manager');
  foreach ($default_config_storage
    ->listAll() as $config_name) {
    if ($active_config_storage
      ->exists($config_name)) {
      $result = $config_manager
        ->diff($default_config_storage, $active_config_storage, $config_name);
      $this
        ->assertConfigDiff($result, $config_name, [
        // The filter.format.*:roles key is a special install key.
        'filter.format.basic_html' => [
          'roles:',
          '  - authenticated',
        ],
        'filter.format.full_html' => [
          'roles:',
          '  - administrator',
        ],
        'filter.format.restricted_html' => [
          'roles:',
          '  - anonymous',
        ],
        // The system.site config is overwritten during tests by
        // FunctionalTestSetupTrait::installParameters().
        'system.site' => [
          'uuid:',
          'name:',
          'mail:',
        ],
      ]);
    }
    else {
      $this
        ->fail("{$config_name} has not been installed");
    }
  }
}