You are here

public function RulesFormsActionsTestCase::testestOptionsAction in Rules Forms Support 7.2

Tests callback for Action: Set multiple value options.

File

./rules_forms.test, line 616
Rules Forms Support tests.

Class

RulesFormsActionsTestCase
Tests Rules Forms actions.

Code

public function testestOptionsAction() {
  $form = array();
  $form['test'] = array(
    '#type' => 'textfield',
    '#options' => array(
      'first' => 'test',
    ),
  );
  $form = new ArrayObject($form);
  $action = rules_action('rules_forms_set_options', array(
    'element' => 'textfield:test',
    'options' => 'first|test' . "\r\n" . 'second|test',
  ));
  $action
    ->executeByArgs(array(
    'form' => $form,
  ));
  $this
    ->assertEqual($form['test']['#options'], array(
    'first' => 'test',
    'second' => 'test',
  ));
}