function CCKSelectOtherBasicTest::testFailValidationForm in CCK Select Other 7
Same name and namespace in other branches
- 6 tests/cck_select_other.test \CCKSelectOtherBasicTest::testFailValidationForm()
- 7.2 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 167 - test file for cck_select_other Testing file
Class
- CCKSelectOtherBasicTest
- @class CCK Select Other Basic Test Case
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();
}