You are here

public function ConfigInstallTest::testLanguage in Drupal 8

Same name and namespace in other branches
  1. 9 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 237

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
    ->assertEqual($this
    ->config('config_test.dynamic.dotted.english')
    ->get('langcode'), 'en');

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