You are here

public function RulesFormsActionsTestCase::testSetDisabledAction in Rules Forms Support 7

Tests callback for Action: Disable form element.

File

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

Class

RulesFormsActionsTestCase
Tests Rules Forms actions.

Code

public function testSetDisabledAction() {
  $form = array();
  $form['test'] = array(
    '#type' => 'textfield',
    '#disabled' => FALSE,
  );
  $form = new ArrayObject($form);
  $action = rules_action('rules_forms_set_disabled', array(
    'element' => 'textfield:test',
    'disabled' => 1,
  ));
  $action
    ->executeByArgs(array(
    'form' => $form,
  ));
  $this
    ->assertTrue($form['test']['#disabled']);
}