Asserts that the default configuration of a module has been installed.
string $module: The name of the module.
bool TRUE if configuration has been installed, FALSE otherwise.
function assertModuleConfig($module) {
$module_config_dir = drupal_get_path('module', $module) . '/config';
if (!is_dir($module_config_dir)) {
return;
}
$module_file_storage = new FileStorage($module_config_dir);
$names = $module_file_storage
->listAll($module . '.');
// Verify that the config directory is not empty.
$this
->assertTrue($names);
// Look up each default configuration object name in the active
// configuration, and if it exists, remove it from the stack.
foreach ($names as $key => $name) {
if (config($name)
->get()) {
unset($names[$key]);
}
}
// Verify that all configuration has been installed (which means that $names
// is empty).
return $this
->assertFalse($names, format_string('All default configuration of @module module found.', array(
'@module' => $module,
)));
}