function CCKSelectOtherNotRequiredTest::testValueToNone in CCK Select Other 7
Same name and namespace in other branches
- 7.2 tests/cck_select_other.test \CCKSelectOtherNotRequiredTest::testValueToNone()
Save a value to the field and then set it to -none-
File
- tests/
cck_select_other.test, line 573 - test file for cck_select_other Testing file
Class
- CCKSelectOtherNotRequiredTest
- @class CCKSelectOtherNotRequiredTest
Code
function testValueToNone() {
$this
->drupalLogin($this->web_user);
// Save a value into the node and assert that it was saved.
$edit = array(
$this->test_instance['field_name'] . '[und][0][select_other_list]' => 'other',
$this->test_instance['field_name'] . '[und][0][select_other_text_input]' => $this
->randomName(15),
);
$this
->drupalPost('node/' . $this->test_node->nid . '/edit', $edit, t('Save'));
$this
->assertRaw($this->test_instance['label']);
$edit = array(
$this->test_instance['field_name'] . '[und][0][select_other_list]' => '_none',
);
$this
->drupalPost('node/' . $this->test_node->nid . '/edit', $edit, t('Save'));
$this
->assertNoRaw($this->test_instance['label']);
// Assert the node object as well.
$node = node_load($this->test_node->nid);
$this
->assertTrue(empty($node->{$this->test_instance['field_name']}), t('Select other did not save any value for non-required field.'));
$this
->drupalLogout();
}