You are here

public function EnvironmentConfigOverrideTest::testStaticOverridesOverriddenNamesWithDynamicEnvironment in Config override 8

File

tests/Unit/EnvironmentConfigOverrideTest.php, line 49

Class

EnvironmentConfigOverrideTest
@coversDefaultClass \Drupal\config_override\EnvironmentConfigOverride @group config_override

Namespace

Drupal\config_override\Tests\Unit

Code

public function testStaticOverridesOverriddenNamesWithDynamicEnvironment() {
  putenv('CONFIG___EXAMPLE___KEY=value_overridden');
  putenv('CONFIG___EXAMPLE_3___KEY3=value3_overridden');
  putenv('CONFIG___EXAMPLE__4___KEY4=value4_overridden');
  $sut = new EnvironmentConfigOverride([
    'example' => [
      'key' => 'value',
      'key2' => 'value2',
    ],
    'example_3' => [
      'key3' => 'value3',
    ],
    'example.4' => [
      'key4' => 'value4',
    ],
  ]);
  $this
    ->assertEquals([
    'example' => [
      'key' => 'value_overridden',
      'key2' => 'value2',
    ],
    'example_3' => [
      'key3' => 'value3_overridden',
    ],
    'example.4' => [
      'key4' => 'value4_overridden',
    ],
  ], $sut
    ->loadOverrides([
    'example',
    'example_3',
    'example.4',
  ]));
}