You are here

function CCKSelectOtherBasicTest::testSelectFieldValue in CCK Select Other 6

Same name and namespace in other branches
  1. 7.2 tests/cck_select_other.test \CCKSelectOtherBasicTest::testSelectFieldValue()
  2. 7 tests/cck_select_other.test \CCKSelectOtherBasicTest::testSelectFieldValue()

Modify node with a new value from select list options

File

tests/cck_select_other.test, line 180
test file for cck_select_other Testing file

Class

CCKSelectOtherBasicTest
@class CCK Select Other Basic Test Case

Code

function testSelectFieldValue() {
  $my_option = array_rand(cck_select_other_options($this->test_field));
  $edit = array(
    'title' => $this->test_node->title,
    'body' => $this->test_node->body,
    'field_blah[select_other_list]' => $my_option,
  );
  if ($my_option == 'other') {
    $edit['field_blah[select_other_text_input]'] = $this
      ->randomName(16);
  }
  $this
    ->drupalPost('node/' . $this->test_node->nid . '/edit', $edit, t('Save'));
  $node = node_load($this->test_node->nid);
  $this
    ->drupalGet('node/' . $this->test_node->nid);
  $this
    ->assertText($my_option, t('Select other field value, %match, displayed on node.', array(
    '%match' => $my_option,
  )));
}