You are here

public function RulesFormsActionsTestCase::testestWeightAction in Rules Forms Support 7.2

Tests callback for Action: Set element weight.

File

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

Class

RulesFormsActionsTestCase
Tests Rules Forms actions.

Code

public function testestWeightAction() {
  $form = array();
  $form['test'] = array(
    '#type' => 'textfield',
    '#weight' => 0,
  );
  $form = new ArrayObject($form);
  $action = rules_action('rules_forms_set_weight', array(
    'element' => 'textfield:test',
    'weight' => 20,
  ));
  $action
    ->executeByArgs(array(
    'form' => $form,
  ));
  $this
    ->assertEqual($form['test']['#weight'], 20);
}