function ConfigLocaleOverride::testConfigLocaleOverride

Tests basic locale override.

File

drupal/core/modules/config/lib/Drupal/config/Tests/ConfigLocaleOverride.php, line 42
Contains \Drupal\config\Tests\ConfigLocaleOverride.

Class

ConfigLocaleOverride
Tests locale config override.

Namespace

Drupal\config\Tests

Code

function testConfigLocaleOverride() {
  $name = 'config_test.system';

  // The default language is en so the config key should be localised.
  $config = config($name);
  $this
    ->assertIdentical($config
    ->get('foo'), 'en bar');
  $this
    ->assertIdentical($config
    ->get('404'), 'herp');

  // Ensure that we get the expected value when we avoid overrides.
  config_context_enter('config.context.free');
  $config_admin = config($name);
  $this
    ->assertIdentical($config_admin
    ->get('foo'), 'bar');
  $this
    ->assertIdentical($config_admin
    ->get('404'), 'herp');

  // Leave the non override context.
  config_context_leave();
  $config = config($name);
  $this
    ->assertIdentical($config
    ->get('foo'), 'en bar');
  $this
    ->assertIdentical($config
    ->get('404'), 'herp');
}