You are here

public function RulesFormsAPITestCase::testGetElement in Rules Forms Support 7.2

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

Tests _rules_forms_get_element().

File

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

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' => 'test select',
    '#options' => array(
      'first' => t('option1'),
      'second' => t('option2'),
    ),
    '#value' => 'test',
    '#default_value' => 'test',
  ));

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