You are here

public function CommentAlterListTextTestCase::testOptionsSelectMultiple in Comment Alter 7

File

./comment_alter.test, line 390
Functional tests for the Comment Alter module.

Class

CommentAlterListTextTestCase
Functional tests for Comment Alter and List (text) fields.

Code

public function testOptionsSelectMultiple() {
  $field_name = $this
    ->createField('list_text', 'options_select', array(
    'settings' => array(
      'allowed_values' => array(
        1 => 'One',
        2 => 'Two',
        3 => 'Three',
      ),
    ),
    'cardinality' => -1,
  ));
  $this
    ->createNodeThenPostComment(array(
    $field_name => array(
      LANGUAGE_NONE => array(
        0 => array(
          'value' => 1,
        ),
      ),
    ),
  ), array(
    "{$field_name}[" . LANGUAGE_NONE . '][]' => array(
      '1',
      '2',
    ),
  ));
  $this
    ->assertCommentDiff(array(
    $field_name => array(
      array(
        'One',
        'One',
      ),
      array(
        NULL,
        'Two',
      ),
    ),
  ));
}