public function KernelTestBaseTest::testInstallConfig in Drupal 8
Tests expected behavior of installConfig().
File
- core/
modules/ simpletest/ src/ Tests/ KernelTestBaseTest.php, line 215
Class
- KernelTestBaseTest
- Tests KernelTestBase functionality.
Namespace
Drupal\simpletest\TestsCode
public function testInstallConfig() {
// The user module has configuration that depends on system.
$this
->enableModules([
'system',
]);
$module = 'user';
// Verify that default config can only be installed for enabled modules.
try {
$this
->installConfig([
$module,
]);
$this
->fail('Exception for non-enabled module found.');
} catch (\Exception $e) {
$this
->pass('Exception for non-enabled module found.');
}
$this
->assertFalse($this->container
->get('config.storage')
->exists('user.settings'));
// Verify that default config can be installed.
$this
->enableModules([
'user',
]);
$this
->installConfig([
'user',
]);
$this
->assertTrue($this->container
->get('config.storage')
->exists('user.settings'));
$this
->assertTrue($this
->config('user.settings')
->get('register'));
}