$this->
drupalGet('admin/modules'
);
$this->
submitForm(['modules[config_install_fail_test][enable]' => TRUE
], 'Install'
);
$this->
assertSession()->
responseContains('Unable to install Configuration install fail test, <em class="placeholder">config_test.dynamic.dotted.default, language/fr/config_test.dynamic.dotted.default</em> already exist in active configuration.'
);
// Test installing a theme through the UI that has existing configuration.
// This relies on the fact the config_test has been installed and created
// the config_test.dynamic.dotted.default configuration and the translation
// override created still exists.
$this->
drupalGet('admin/appearance'
);
$url =
$this->
xpath("//a[contains(@href,'config_clash_test_theme') and contains(@href,'/install?')]/@href"
)[0
];
$this->
drupalGet($this->
getAbsoluteUrl($url->
getText()));
$this->
assertSession()->
responseContains('Unable to install config_clash_test_theme, <em class="placeholder">config_test.dynamic.dotted.default, language/fr/config_test.dynamic.dotted.default</em> already exist in active configuration.'
);
// Test installing a theme through the API that has existing configuration.
try { \Drupal::
service('theme_installer'
)->
install(['config_clash_test_theme'
]);
$this->
fail('Expected PreExistingConfigException not thrown.'
);
} catch (PreExistingConfigException
$e) { $this->
assertEquals('config_clash_test_theme',
$e->
getExtension());
$this->
assertEquals([StorageInterface::DEFAULT_COLLECTION =>
['config_test.dynamic.dotted.default'
], 'language.fr' =>
['config_test.dynamic.dotted.default'
]],
$e->
getConfigObjects());
$this->
assertEquals('Configuration objects (config_test.dynamic.dotted.default, language/fr/config_test.dynamic.dotted.default) provided by config_clash_test_theme already exist in active configuration',
$e->
getMessage());
}