You are here

public function RulesFormsActionsTestCase::testSetOptionsAction in Rules Forms Support 7

Tests callback for Action: Set multiple value options.

File

./rules_forms.test, line 591
Stores tests related to Rules Form.

Class

RulesFormsActionsTestCase
Tests Rules Forms actions.

Code

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