You are here

public function RulesFormsActionsTestCase::testSetPrefixSuffixAction in Rules Forms Support 7

Tests callback for Action: Set element prefix/suffix HTML.

File

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

Class

RulesFormsActionsTestCase
Tests Rules Forms actions.

Code

public function testSetPrefixSuffixAction() {
  $form = array();
  $form['test'] = array(
    '#type' => 'textfield',
    '#prefix' => 'tset',
    '#suffix' => 'test',
  );
  $form = new ArrayObject($form);
  $action = rules_action('rules_forms_set_prefix_suffix', array(
    'element' => 'textfield:test',
    'prefix' => '<div id="test">',
    'suffix' => '</div>',
  ));
  $action
    ->executeByArgs(array(
    'form' => $form,
  ));
  $this
    ->assertEqual($form['test']['#prefix'], '<div id="test">');
  $this
    ->assertEqual($form['test']['#suffix'], '</div>');
}