Tests the case when the language select elements should not be printed.
This happens when the language module is disabled.
function testHiddenLanguageSelectElement() {
// Disable the language module, so that the language select field will not
// be rendered.
module_disable(array(
'language',
));
$this
->drupalGet('form-test/language_select');
// Check that the language fields were rendered on the page.
$ids = array(
'edit-languages-all',
'edit-languages-configurable',
'edit-languages-locked',
'edit-languages-config-and-locked',
);
foreach ($ids as $id) {
$this
->assertNoField($id, format_string('The @id field was not found on the page.', array(
'@id' => $id,
)));
}
// Check that the submitted values were the default values of the language
// field elements.
$edit = array();
$this
->drupalPost(NULL, $edit, t('Submit'));
$values = drupal_json_decode($this
->drupalGetContent());
$this
->assertEqual($values['languages_all'], 'xx');
$this
->assertEqual($values['languages_configurable'], 'en');
$this
->assertEqual($values['languages_locked'], LANGUAGE_NOT_SPECIFIED);
$this
->assertEqual($values['languages_config_and_locked'], 'dummy_value');
$this
->assertEqual($values['language_custom_options'], 'opt2');
}