LanguageConfigSchemaTest.php in Drupal 8
File
core/modules/language/tests/src/Functional/LanguageConfigSchemaTest.php
View source
<?php
namespace Drupal\Tests\language\Functional;
use Drupal\Tests\SchemaCheckTestTrait;
use Drupal\Tests\BrowserTestBase;
class LanguageConfigSchemaTest extends BrowserTestBase {
use SchemaCheckTestTrait;
public static $modules = [
'language',
'menu_link_content',
];
protected $defaultTheme = 'stark';
protected $adminUser;
protected function setUp() {
parent::setUp();
$this->adminUser = $this
->drupalCreateUser([
'administer languages',
]);
$this
->drupalLogin($this->adminUser);
}
public function testValidLanguageConfigSchema() {
$config_data = $this
->config('language.settings')
->get();
$this
->assertTrue(empty($config_data));
$settings_path = 'admin/config/regional/content-language';
$edit['entity_types[menu_link_content]'] = TRUE;
$edit['settings[menu_link_content][menu_link_content][settings][language][language_alterable]'] = TRUE;
$edit['entity_types[user]'] = TRUE;
$edit['settings[user][user][settings][language][language_alterable]'] = TRUE;
$edit['settings[user][user][settings][language][langcode]'] = 'en';
$this
->drupalPostForm($settings_path, $edit, t('Save configuration'));
$config_data = $this
->config('language.content_settings.menu_link_content.menu_link_content');
$this
->assertTrue($config_data
->get('language_alterable'));
$this
->assertConfigSchema(\Drupal::service('config.typed'), $config_data
->getName(), $config_data
->get());
}
}