class LanguageConfigSchemaTest in Drupal 10
Same name and namespace in other branches
- 8 core/modules/language/tests/src/Functional/LanguageConfigSchemaTest.php \Drupal\Tests\language\Functional\LanguageConfigSchemaTest
- 9 core/modules/language/tests/src/Functional/LanguageConfigSchemaTest.php \Drupal\Tests\language\Functional\LanguageConfigSchemaTest
Ensures the language config schema is correct.
@group language
Hierarchy
- class \Drupal\Tests\BrowserTestBase extends \PHPUnit\Framework\TestCase uses \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, FunctionalTestSetupTrait, TestSetupTrait, BlockCreationTrait, ConfigTestTrait, ExtensionListTestTrait, ContentTypeCreationTrait, NodeCreationTrait, RandomGeneratorTrait, TestRequirementsTrait, PhpUnitWarnings, UiHelperTrait, UserCreationTrait, XdebugRequestTrait
- class \Drupal\Tests\language\Functional\LanguageConfigSchemaTest uses SchemaCheckTestTrait
Expanded class hierarchy of LanguageConfigSchemaTest
File
- core/
modules/ language/ tests/ src/ Functional/ LanguageConfigSchemaTest.php, line 13
Namespace
Drupal\Tests\language\FunctionalView source
class LanguageConfigSchemaTest extends BrowserTestBase {
use SchemaCheckTestTrait;
/**
* Modules to enable.
*
* @var array
*/
protected static $modules = [
'language',
'menu_link_content',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* A user with administrative permissions.
*
* @var \Drupal\user\UserInterface
*/
protected $adminUser;
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
// Create user.
$this->adminUser = $this
->drupalCreateUser([
'administer languages',
]);
$this
->drupalLogin($this->adminUser);
}
/**
* Tests whether the language config schema is valid.
*/
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());
}
}