function ConfigInstallTest::testLanguage

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Config/ConfigInstallTest.php \Drupal\KernelTests\Core\Config\ConfigInstallTest::testLanguage()
  2. 8.9.x core/tests/Drupal/KernelTests/Core/Config/ConfigInstallTest.php \Drupal\KernelTests\Core\Config\ConfigInstallTest::testLanguage()
  3. 10 core/tests/Drupal/KernelTests/Core/Config/ConfigInstallTest.php \Drupal\KernelTests\Core\Config\ConfigInstallTest::testLanguage()

Tests imported configuration entities with/without language information.

File

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

Class

ConfigInstallTest
Tests installation of configuration objects in installation functionality.

Namespace

Drupal\KernelTests\Core\Config

Code

public function testLanguage() : void {
    $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'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.