function SelectOrOtherTextTestCase::testOtherSelectedWithPreExistingKey in Select (or other) 7.3
Same name and namespace in other branches
- 7.2 tests/select_or_other_text.test \SelectOrOtherTextTestCase::testOtherSelectedWithPreExistingKey()
Tests if other values which correspond with a pre-existing key are saved using the pre-existing key instead of creating duplicate entries.
File
- tests/
select_or_other_text.test, line 55
Class
- SelectOrOtherTextTestCase
- Tests the select or other text field based functionality
Code
function testOtherSelectedWithPreExistingKey() {
foreach ($this->fields as $field_name => $field) {
$this
->setFieldValue($field_name, 'select_or_other', 'keyed');
$this
->assertRaw('keyed');
$this
->assertNoRaw('select_or_other');
// Edit the node.
$this
->clickLink(t('Edit'));
// Make sure the pre-existing option was selected.
if ($field['widget'] === 'select_or_other') {
// Select widgets have options which get selected.
$this
->assertOptionSelected("edit-{$field_name}-und-select", 'keyed');
}
else {
// Checkboxes and radios have options that get checked.
$this
->assertFieldChecked("edit-{$field_name}-und-select-keyed");
}
$this
->assertFieldByName("{$field_name}[und][other]", '');
}
}