You are here

public function RulesFormsActionsTestCase::testSetDefaultAction in Rules Forms Support 7

Tests callback for Action: Set default value of a form element.

File

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

Class

RulesFormsActionsTestCase
Tests Rules Forms actions.

Code

public function testSetDefaultAction() {
  $form = array();
  $form['test'] = array(
    '#type' => 'textfield',
    '#default_value' => 'tset',
  );
  $form = new ArrayObject($form);
  $action = rules_action('rules_forms_set_default', array(
    'element' => 'textfield:test',
    'value' => 'test',
  ));
  $action
    ->executeByArgs(array(
    'form' => $form,
  ));
  $this
    ->assertEqual($form['test']['#default_value'], 'test');
}