class ModuleConfigOverridesTest in Config override 8
@coversDefaultClass \Drupal\config_override\ModuleConfigOverrides @group config_override
Hierarchy
- class \Drupal\config_override\Tests\Unit\ModuleConfigOverridesTest extends \PHPUnit\Framework\TestCase
Expanded class hierarchy of ModuleConfigOverridesTest
File
- tests/
Unit/ ModuleConfigOverridesTest.php, line 17
Namespace
Drupal\config_override\Tests\UnitView source
class ModuleConfigOverridesTest extends TestCase {
public function testModuleOverrides() {
$cache_backend = $this
->prophesize(CacheBackendInterface::class);
$module_handler = $this
->prophesize(ModuleHandlerInterface::class);
$extension_a = new Extension('vfs://drupal', 'module', 'modules/module_a/module_a.info.yml');
$extension_b = new Extension('vfs://drupal', 'module', 'modules/module_b/module_b.info.yml');
vfsStream::setup('drupal');
vfsStream::create([
'modules' => [
'module_a' => [
'config' => [
'override' => [
'system.site.yml' => Yaml::encode([
'name' => 'Hey jude',
]),
],
],
],
'module_b' => [
'config' => [
'override' => [
'system.site.yml' => Yaml::encode([
'slogan' => 'Muh',
]),
],
],
],
],
]);
$module_handler
->getModuleList()
->willReturn([
'module_a' => $extension_a,
'module_b' => $extension_b,
]);
$module_overrides = new ModuleConfigOverrides('vfs://drupal', $module_handler
->reveal(), $cache_backend
->reveal());
$expected = [
'system.site' => [
'name' => 'Hey jude',
'slogan' => 'Muh',
],
];
$result = $module_overrides
->loadOverrides([
'system.site',
]);
$this
->assertEquals($expected, $result);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ModuleConfigOverridesTest:: |
public | function |