public function LanguageConfigurationElementTest::testTaxonomyVocabularyUpdate in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/modules/language/src/Tests/LanguageConfigurationElementTest.php \Drupal\language\Tests\LanguageConfigurationElementTest::testTaxonomyVocabularyUpdate()
Tests that the configuration is retained when a vocabulary is updated.
File
- core/
modules/ language/ src/ Tests/ LanguageConfigurationElementTest.php, line 225 - Contains \Drupal\language\Tests\LanguageConfigurationElementTest.
Class
- LanguageConfigurationElementTest
- Tests the features of the language configuration element field.
Namespace
Drupal\language\TestsCode
public function testTaxonomyVocabularyUpdate() {
$vocabulary = entity_create('taxonomy_vocabulary', array(
'name' => 'Country',
'vid' => 'country',
));
$vocabulary
->save();
$admin_user = $this
->drupalCreateUser(array(
'administer taxonomy',
));
$this
->drupalLogin($admin_user);
$edit = array(
'default_language[langcode]' => 'current_interface',
'default_language[language_alterable]' => TRUE,
);
$this
->drupalPostForm('admin/structure/taxonomy/manage/country', $edit, t('Save'));
// Check the language default configuration.
$configuration = ContentLanguageSettings::loadByEntityTypeBundle('taxonomy_term', 'country');
$uuid = $configuration
->uuid();
$this
->assertEqual($configuration
->getDefaultLangcode(), 'current_interface', '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 = array(
'name' => 'Nation',
);
$this
->drupalPostForm('admin/structure/taxonomy/manage/country', $edit, t('Save'));
// Check that we still have the settings for the updated vocabulary.
$configuration = ContentLanguageSettings::loadByEntityTypeBundle('taxonomy_term', 'country');
$this
->assertEqual($configuration
->getDefaultLangcode(), 'current_interface', '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
->assertEqual($configuration
->uuid(), $uuid, 'The language configuration uuid has been kept on the updated Country vocabulary.');
}