public function ConfigImporterTest::testInstallProfile in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php \Drupal\KernelTests\Core\Config\ConfigImporterTest::testInstallProfile()
- 10 core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php \Drupal\KernelTests\Core\Config\ConfigImporterTest::testInstallProfile()
Tests install profile validation during configuration import.
See also
\Drupal\Core\EventSubscriber\ConfigImportSubscriber
File
- core/
tests/ Drupal/ KernelTests/ Core/ Config/ ConfigImporterTest.php, line 695
Class
- ConfigImporterTest
- Tests importing configuration from files into active configuration.
Namespace
Drupal\KernelTests\Core\ConfigCode
public function testInstallProfile() {
$sync = $this->container
->get('config.storage.sync');
$extensions = $sync
->read('core.extension');
// Add an install profile.
$extensions['module']['standard'] = 0;
$sync
->write('core.extension', $extensions);
try {
$this->configImporter
->reset()
->import();
$this
->fail('ConfigImporterException not thrown; an invalid import was not stopped due to missing dependencies.');
} catch (ConfigImporterException $e) {
$expected = static::FAIL_MESSAGE . PHP_EOL . 'Unable to install the <em class="placeholder">standard</em> module since it does not exist.';
$this
->assertEquals($expected, $e
->getMessage(), 'There were errors validating the config synchronization.');
$error_log = $this->configImporter
->getErrors();
// Install profiles should not even be scanned at this point.
$this
->assertEqual([
'Unable to install the <em class="placeholder">standard</em> module since it does not exist.',
], $error_log);
}
}