You are here

public function ConfigOverrideServiceProviderTest::testWithEnvironmentFilesAndOverrideInSitesDefault in Config override 8

@covers ::alter

File

tests/Unit/ConfigOverrideServiceProviderTest.php, line 132

Class

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

Namespace

Drupal\config_override\Tests\Unit

Code

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