You are here

public function RulesFormsAPITestCase::testGetElement in Rules Forms Support 7

Same name and namespace in other branches
  1. 7.2 rules_forms.test \RulesFormsAPITestCase::testGetElement()

Tests _rules_forms_get_element().

File

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

Class

RulesFormsAPITestCase
Tests Rules Forms actions.

Code

public function testGetElement() {

  // Test retrieving the element.
  $form = self::$form;
  $element_id = 'select:fieldset:select';
  $element =& _rules_forms_get_element($form, $element_id);
  $this
    ->assertEqual($element, array(
    '#type' => 'select',
    '#title' => 'tset select',
    '#options' => array(
      'first' => t('option1'),
      'second' => t('option2'),
    ),
    '#value' => 'tset',
    '#default_value' => 'test',
  ));

  // Test the reference.
  $element['#title'] = 'test select';
  $this
    ->assertEqual($form['fieldset']['select']['#title'], 'test select');
}