VocabularyTranslationTest.php in Zircon Profile 8.0
File
core/modules/taxonomy/src/Tests/VocabularyTranslationTest.php
View source
<?php
namespace Drupal\taxonomy\Tests;
use Drupal\Component\Utility\Unicode;
class VocabularyTranslationTest extends TaxonomyTestBase {
public static $modules = array(
'content_translation',
'language',
);
protected function setUp() {
parent::setUp();
$this
->drupalLogin($this
->drupalCreateUser([
'administer taxonomy',
'administer content translation',
]));
}
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 = Unicode::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.');
}
}