function SelectOrOtherTextTestCase::testOtherSelectedWithPreExistingKey in Select (or other) 7.2
Same name and namespace in other branches
- 7.3 tests/select_or_other_text.test \SelectOrOtherTextTestCase::testOtherSelectedWithPreExistingKey()
File
- tests/select_or_other_text.test, line 149
Class
- SelectOrOtherTextTestCase
- Tests the select or other text field based functionality
Code
function testOtherSelectedWithPreExistingKey() {
$edit = array();
$langcode = LANGUAGE_NONE;
$edit["title"] = $this
->randomName(8);
$edit["{$this->single_field_name}[{$langcode}][select]"] = 'select_or_other';
$edit["{$this->single_field_name}[{$langcode}][other]"] = 'keyed';
$edit["{$this->multi_field_name}[{$langcode}][select][]"] = array(
'multi_keyed',
'select_or_other',
);
$edit["{$this->multi_field_name}[{$langcode}][other]"] = 'multi_unkeyed';
$this
->drupalPost('node/add/page', $edit, t('Save'));
$this
->assertRaw('keyed');
$this
->assertRaw('multi_keyed');
$this
->assertRaw('multi_unkeyed');
$this
->assertNoRaw('select_or_other');
$this
->drupalGet('node/1/edit');
$this
->assertFieldByName("{$this->single_field_name}[{$langcode}][other]", '');
$this
->assertOptionSelected("edit-{$this->single_field_name}-und-select", 'keyed');
$this
->assertFieldByName("{$this->multi_field_name}[{$langcode}][other]", '');
$this
->assertFieldByName("{$this->multi_field_name}[{$langcode}][select][]", 'multi_keyed');
$this
->assertOptionSelected("edit-{$this->multi_field_name}-und-select", 'multi_keyed');
$this
->assertOptionSelected("edit-{$this->multi_field_name}-und-select", 'multi_unkeyed');
}