You are here

public function ConfigOverrideServiceProviderTest::testWithEnvironmentFiles in Config override 8

@covers ::alter

File

tests/Unit/ConfigOverrideServiceProviderTest.php, line 96

Class

ConfigOverrideServiceProviderTest
@coversDefaultClass \Drupal\config_override\ConfigOverrideServiceProvider @group config_override

Namespace

Drupal\config_override\Tests\Unit

Code

public function testWithEnvironmentFiles() {
  $vfs_root = vfsStream::setup('drupal_root');
  vfsStream::create([
    'sites/default/.environment' => '
CONFIG___NAME___KEY2=value2
CONFIG___NAME3___KEY3=value3
',
    'sites/default/.env' => '
CONFIG___NAME___KEY=value
CONFIG___NAME2___KEY2=value2
',
  ]);
  $sut = new ConfigOverrideServiceProvider();
  $container = new ContainerBuilder();
  $container
    ->set('app.root', $vfs_root
    ->url());
  $sut
    ->alter($container);
  $this
    ->assertEquals([
    'name' => [
      'key' => 'value',
      'key2' => 'value2',
    ],
    'name2' => [
      'key2' => 'value2',
    ],
    'name3' => [
      'key3' => 'value3',
    ],
  ], $container
    ->getParameter('config_override__environment'));
}