public function SelectOrOtherAdminTestCase::testAvailableOptions in Select (or other) 7.3
Same name and namespace in other branches
- 7.2 tests/select_or_other_admin.test \SelectOrOtherAdminTestCase::testAvailableOptions()
Regression test for the available options field.
Empty lines would cause notices when displaying field values with the select or other field formatter.
File
- tests/
select_or_other_admin.test, line 77
Class
- SelectOrOtherAdminTestCase
- Tests administration of select or other field widgets and formatters.
Code
public function testAvailableOptions() {
$langcode = LANGUAGE_NONE;
// Change field settings.
$edit = array(
'instance[widget][settings][available_options]' => "keyed|Keyed\r\nunkeyed\r\n",
);
$this
->drupalpost("admin/structure/types/manage/page/fields/{$this->field['field_name']}", $edit, t('Save settings'));
// Change field display settings.
$edit = array(
"fields[{$this->field['field_name']}][type]" => 'select_or_other_formatter',
);
$this
->drupalpost("admin/structure/types/manage/page/display/", $edit, t('Save'));
// Create a node
$edit = array(
"title" => $this
->randomName(8),
"{$this->field['field_name']}[{$langcode}][select][]" => 'keyed',
);
$this
->drupalPost('node/add/page', $edit, t('Save'));
// Check if the values have been created.
$this
->assertRaw('Keyed');
}