3 namespace Drupal\system\Tests\Installer;
5 @trigger_error(__NAMESPACE__ . '\ConfigAfterInstallerTestBase is deprecated in Drupal 8.6.0 and will be removed before Drupal 9.0.0. Instead, use \Drupal\FunctionalTests\Installer\ConfigAfterInstallerTestBase.', E_USER_DEPRECATED);
7 use Drupal\Core\Config\FileStorage;
8 use Drupal\Core\Config\InstallStorage;
9 use Drupal\Core\Config\StorageInterface;
10 use Drupal\KernelTests\AssertConfigTrait;
11 use Drupal\simpletest\InstallerTestBase;
14 * Provides a class for install profiles to check their installed config.
16 * @deprecated in Drupal 8.6.0 and will be removed before Drupal 9.0.0.
17 * Use \Drupal\FunctionalTests\Installer\ConfigAfterInstallerTestBase.
19 abstract class ConfigAfterInstallerTestBase extends InstallerTestBase {
21 use AssertConfigTrait;
24 * Ensures that all the installed config looks like the exported one.
26 * @param array $skipped_config
27 * An array of skipped config.
29 protected function assertInstalledConfig(array $skipped_config) {
30 /** @var \Drupal\Core\Config\StorageInterface $active_config_storage */
31 $active_config_storage = $this->container->get('config.storage');
32 /** @var \Drupal\Core\Config\ConfigManagerInterface $config_manager */
33 $config_manager = $this->container->get('config.manager');
35 $default_install_path = 'core/profiles/' . $this->profile . '/' . InstallStorage::CONFIG_INSTALL_DIRECTORY;
36 $profile_config_storage = new FileStorage($default_install_path, StorageInterface::DEFAULT_COLLECTION);
38 foreach ($profile_config_storage->listAll() as $config_name) {
39 $result = $config_manager->diff($profile_config_storage, $active_config_storage, $config_name);
41 $this->assertConfigDiff($result, $config_name, $skipped_config);
43 catch (\Exception $e) {
44 $this->fail($e->getMessage());