function CCKSelectOtherBasicTest::testFailValidationForm in CCK Select Other 7.2
Same name and namespace in other branches
- 6 tests/cck_select_other.test \CCKSelectOtherBasicTest::testFailValidationForm()
- 7 tests/cck_select_other.test \CCKSelectOtherBasicTest::testFailValidationForm()
Fail validation of node edit form, check option values TODO: I don't think I can resave the same form with drupalPost
File
- tests/
cck_select_other.test, line 164 - CCK Select Other Functional Tests
Class
- CCKSelectOtherBasicTest
- Assert basic select other list operations.
Code
function testFailValidationForm() {
$my_option = array_rand(cck_select_other_options($this->test_instance));
$this
->drupalLogin($this->web_user);
$select_field = $this->test_field['field_name'] . '[und][0][select_other_list]';
$text_field = $this->test_field['field_name'] . '[und][0][select_other_text_input]';
$edit = array(
'title' => '',
$select_field => $my_option,
);
if ($my_option == 'other') {
$edit[$text_field] = $this
->randomName(16);
}
$field_str = str_replace('_', '-', $this->test_field['field_name']);
$this
->drupalPost('node/' . $this->test_node->nid . '/edit', $edit, t('Save'));
$this
->assertFieldById('edit-' . $field_str . '-und-0-select-other-list', $my_option, t('Select field value matches'));
$this
->drupalLogout();
}