function LanguageConfigSchemaTest::testValidLanguageConfigSchema

Same name in other branches
  1. 8.9.x core/modules/language/tests/src/Functional/LanguageConfigSchemaTest.php \Drupal\Tests\language\Functional\LanguageConfigSchemaTest::testValidLanguageConfigSchema()
  2. 10 core/modules/language/tests/src/Functional/LanguageConfigSchemaTest.php \Drupal\Tests\language\Functional\LanguageConfigSchemaTest::testValidLanguageConfigSchema()
  3. 11.x core/modules/language/tests/src/Functional/LanguageConfigSchemaTest.php \Drupal\Tests\language\Functional\LanguageConfigSchemaTest::testValidLanguageConfigSchema()

Tests whether the language config schema is valid.

File

core/modules/language/tests/src/Functional/LanguageConfigSchemaTest.php, line 50

Class

LanguageConfigSchemaTest
Ensures the language config schema is correct.

Namespace

Drupal\Tests\language\Functional

Code

public function testValidLanguageConfigSchema() {
    // Make sure no language configuration available by default.
    $config_data = $this->config('language.settings')
        ->get();
    $this->assertEmpty($config_data);
    $settings_path = 'admin/config/regional/content-language';
    // Enable translation for menu link.
    $edit['entity_types[menu_link_content]'] = TRUE;
    $edit['settings[menu_link_content][menu_link_content][settings][language][language_alterable]'] = TRUE;
    // Enable translation for user.
    $edit['entity_types[user]'] = TRUE;
    $edit['settings[user][user][settings][language][language_alterable]'] = TRUE;
    $edit['settings[user][user][settings][language][langcode]'] = 'en';
    $this->drupalGet($settings_path);
    $this->submitForm($edit, 'Save configuration');
    $config_data = $this->config('language.content_settings.menu_link_content.menu_link_content');
    // Make sure configuration saved correctly.
    $this->assertTrue($config_data->get('language_alterable'));
    $this->assertConfigSchema(\Drupal::service('config.typed'), $config_data->getName(), $config_data->get());
}

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