function testTermLanguage() {
// Configure the vocabulary to not hide the language selector.
$edit = array(
'default_language[language_hidden]' => FALSE,
);
$this
->drupalPost('admin/structure/taxonomy/' . $this->vocabulary->machine_name . '/edit', $edit, t('Save'));
// Add a term.
$this
->drupalGet('admin/structure/taxonomy/' . $this->vocabulary->machine_name . '/add');
// Check that we have the language selector.
$this
->assertField('edit-langcode', t('The language selector field was found on the page'));
// Submit the term.
$edit = array(
'name' => $this
->randomName(),
'langcode' => 'aa',
);
$this
->drupalPost(NULL, $edit, t('Save'));
$terms = taxonomy_term_load_multiple_by_name($edit['name']);
$term = reset($terms);
$this
->assertEqual($term->langcode, $edit['langcode']);
// Check if on the edit page the language is correct.
$this
->drupalGet('taxonomy/term/' . $term->tid . '/edit');
$this
->assertOptionSelected('edit-langcode', $edit['langcode'], t('The term language was correctly selected.'));
// Change the language of the term.
$edit['langcode'] = 'bb';
$this
->drupalPost('taxonomy/term/' . $term->tid . '/edit', $edit, t('Save'));
// Check again that on the edit page the language is correct.
$this
->drupalGet('taxonomy/term/' . $term->tid . '/edit');
$this
->assertOptionSelected('edit-langcode', $edit['langcode'], t('The term language was correctly selected.'));
}