You are here

function ConfigInstallTest::testLanguage in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/config/src/Tests/ConfigInstallTest.php \Drupal\config\Tests\ConfigInstallTest::testLanguage()

Tests imported configuration entities with and without language information.

File

core/modules/config/src/Tests/ConfigInstallTest.php, line 223
Contains \Drupal\config\Tests\ConfigInstallTest.

Class

ConfigInstallTest
Tests installation of configuration objects in installation functionality.

Namespace

Drupal\config\Tests

Code

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');
}