function ConfigImporterTest::testRequiredModuleValidation
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php \Drupal\KernelTests\Core\Config\ConfigImporterTest::testRequiredModuleValidation()
- 10 core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php \Drupal\KernelTests\Core\Config\ConfigImporterTest::testRequiredModuleValidation()
Tests uninstall validators being called during synchronization.
See also
\Drupal\Core\EventSubscriber\ConfigImportSubscriber
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Config/ ConfigImporterTest.php, line 672
Class
- ConfigImporterTest
- Tests importing configuration from files into active configuration.
Namespace
Drupal\KernelTests\Core\ConfigCode
public function testRequiredModuleValidation() : void {
$sync = $this->container
->get('config.storage.sync');
$extensions = $sync->read('core.extension');
unset($extensions['module']['system']);
$sync->write('core.extension', $extensions);
$config_importer = $this->configImporter();
try {
$config_importer->import();
$this->fail('ConfigImporterException not thrown, invalid import was not stopped due to missing dependencies.');
} catch (ConfigImporterException $e) {
$this->assertStringContainsString('There were errors validating the config synchronization.', $e->getMessage());
$error_log = $config_importer->getErrors();
$this->assertEquals('Unable to uninstall the System module because: The System module is required.', $error_log[0]);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.