diff --git a/core/modules/system/src/Tests/Module/ConfigLangTypeTest.php b/core/modules/system/src/Tests/Module/ConfigLangTypeTest.php new file mode 100644 index 0000000..a19a8c8 --- /dev/null +++ b/core/modules/system/src/Tests/Module/ConfigLangTypeTest.php @@ -0,0 +1,68 @@ +drupalCreateUser(array('administer languages')); + $this->drupalLogin($admin_user); + } + + /** + * Tests alteration config of configurable language types. + */ + function testConfigLangTypeAlterations() { + + // Default of config. + $test_type = LanguageInterface::TYPE_CONTENT; + $this->assertTrue(!$this->checkTypeConfigurable($test_type), 'Language type is not configurable.'); + + // Editing config. + $edit = [$test_type . '[configurable]' => TRUE]; + $this->drupalPostForm('admin/config/regional/language/detection', $edit, t('Save settings')); + $this->assertTrue($this->checkTypeConfigurable($test_type), 'Language type is now configurable.'); + + // After installing another module, the config should be the same. + $this->container->get('module_installer')->install(array('field')); + $this->assertTrue($this->checkTypeConfigurable($test_type), 'Language type is still configurable.'); + + } + + /** + * Checks whether the given language type is configurable. + * + * @param $type + * @return bool + */ + protected function checkTypeConfigurable($type) { + $configurable_types = $this->config('language.types')->get('configurable'); + return in_array($type, $configurable_types); + } +}