You are here

public function ConfigInstallTest::testLanguage in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/Core/Config/ConfigInstallTest.php \Drupal\KernelTests\Core\Config\ConfigInstallTest::testLanguage()

Tests imported configuration entities with and without language information.

File

core/tests/Drupal/KernelTests/Core/Config/ConfigInstallTest.php, line 233

Class

ConfigInstallTest
Tests installation of configuration objects in installation functionality.

Namespace

Drupal\KernelTests\Core\Config

Code

public function testLanguage() {
  $this
    ->installModules([
    'config_test_language',
  ]);

  // Test imported configuration with implicit language code.
  $storage = new InstallStorage();
  $data = $storage
    ->read('config_test.dynamic.dotted.english');
  $this
    ->assertTrue(!isset($data['langcode']));
  $this
    ->assertEquals('en', $this
    ->config('config_test.dynamic.dotted.english')
    ->get('langcode'));

  // Test imported configuration with explicit language code.
  $data = $storage
    ->read('config_test.dynamic.dotted.french');
  $this
    ->assertEquals('fr', $data['langcode']);
  $this
    ->assertEquals('fr', $this
    ->config('config_test.dynamic.dotted.french')
    ->get('langcode'));
}