3 namespace Drupal\FunctionalTests\Installer;
5 use Drupal\Core\Config\FileStorage;
6 use Drupal\Core\Config\InstallStorage;
7 use Drupal\Core\Config\StorageInterface;
8 use Drupal\KernelTests\AssertConfigTrait;
11 * Provides a class for install profiles to check their installed config.
13 abstract class ConfigAfterInstallerTestBase extends InstallerTestBase {
15 use AssertConfigTrait;
18 * Ensures that all the installed config looks like the exported one.
20 * @param array $skipped_config
21 * An array of skipped config.
23 protected function assertInstalledConfig(array $skipped_config) {
24 $this->addToAssertionCount(1);
25 /** @var \Drupal\Core\Config\StorageInterface $active_config_storage */
26 $active_config_storage = $this->container->get('config.storage');
27 /** @var \Drupal\Core\Config\ConfigManagerInterface $config_manager */
28 $config_manager = $this->container->get('config.manager');
30 $default_install_path = 'core/profiles/' . $this->profile . '/' . InstallStorage::CONFIG_INSTALL_DIRECTORY;
31 $profile_config_storage = new FileStorage($default_install_path, StorageInterface::DEFAULT_COLLECTION);
33 foreach ($profile_config_storage->listAll() as $config_name) {
34 $result = $config_manager->diff($profile_config_storage, $active_config_storage, $config_name);
36 $this->assertConfigDiff($result, $config_name, $skipped_config);
38 catch (\Exception $e) {
39 $this->fail($e->getMessage());