public function LanguageConfigurationElementTest::testTaxonomyVocabularyUpdate in Drupal 10
Same name and namespace in other branches
- 8 core/modules/language/tests/src/Functional/LanguageConfigurationElementTest.php \Drupal\Tests\language\Functional\LanguageConfigurationElementTest::testTaxonomyVocabularyUpdate()
- 9 core/modules/language/tests/src/Functional/LanguageConfigurationElementTest.php \Drupal\Tests\language\Functional\LanguageConfigurationElementTest::testTaxonomyVocabularyUpdate()
Tests that the configuration is retained when a vocabulary is updated.
File
- core/
modules/ language/ tests/ src/ Functional/ LanguageConfigurationElementTest.php, line 241
Class
- LanguageConfigurationElementTest
- Tests the features of the language configuration element field.
Namespace
Drupal\Tests\language\FunctionalCode
public function testTaxonomyVocabularyUpdate() {
$vocabulary = Vocabulary::create([
'name' => 'Country',
'vid' => 'country',
]);
$vocabulary
->save();
$admin_user = $this
->drupalCreateUser([
'administer taxonomy',
]);
$this
->drupalLogin($admin_user);
$edit = [
'default_language[langcode]' => 'current_interface',
'default_language[language_alterable]' => TRUE,
];
$this
->drupalGet('admin/structure/taxonomy/manage/country');
$this
->submitForm($edit, 'Save');
// Check the language default configuration.
$configuration = ContentLanguageSettings::loadByEntityTypeBundle('taxonomy_term', 'country');
$uuid = $configuration
->uuid();
$this
->assertEquals('current_interface', $configuration
->getDefaultLangcode(), 'The default language configuration has been saved on the Country vocabulary.');
$this
->assertTrue($configuration
->isLanguageAlterable(), 'The alterable language configuration has been saved on the Country vocabulary.');
// Update the vocabulary.
$edit = [
'name' => 'Nation',
];
$this
->drupalGet('admin/structure/taxonomy/manage/country');
$this
->submitForm($edit, 'Save');
// Check that we still have the settings for the updated vocabulary.
$configuration = ContentLanguageSettings::loadByEntityTypeBundle('taxonomy_term', 'country');
$this
->assertEquals('current_interface', $configuration
->getDefaultLangcode(), 'The default language configuration has been kept on the updated Country vocabulary.');
$this
->assertTrue($configuration
->isLanguageAlterable(), 'The alterable language configuration has been kept on the updated Country vocabulary.');
$this
->assertEquals($uuid, $configuration
->uuid(), 'The language configuration uuid has been kept on the updated Country vocabulary.');
}