VocabularyTranslationTest.php in Drupal 8
File
core/modules/taxonomy/tests/src/Functional/VocabularyTranslationTest.php
View source
<?php
namespace Drupal\Tests\taxonomy\Functional;
class VocabularyTranslationTest extends TaxonomyTestBase {
public static $modules = [
'content_translation',
'language',
];
protected $defaultTheme = 'stark';
protected function setUp() {
parent::setUp();
$this
->drupalLogin($this
->drupalCreateUser([
'administer taxonomy',
'administer content translation',
]));
}
public function testVocabularyLanguage() {
$this
->drupalGet('admin/structure/taxonomy/add');
$this
->assertField('edit-default-language-content-translation', 'The content translation checkbox is present on the page.');
$vid = mb_strtolower($this
->randomMachineName());
$edit['name'] = $this
->randomMachineName();
$edit['description'] = $this
->randomMachineName();
$edit['langcode'] = 'en';
$edit['vid'] = $vid;
$edit['default_language[content_translation]'] = TRUE;
$this
->drupalPostForm(NULL, $edit, t('Save'));
$this
->drupalGet('admin/structure/taxonomy/manage/' . $vid);
$this
->assertFieldChecked('edit-default-language-content-translation', 'The content translation was correctly selected.');
}
}