You are here

public function RulesFormsActionsTestCase::testSetWeightAction in Rules Forms Support 7

Tests callback for Action: Set element weight.

File

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

Class

RulesFormsActionsTestCase
Tests Rules Forms actions.

Code

public function testSetWeightAction() {
  $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);
}