You are here

public function FormBaseTest::test_getElementsInPreOrder in Form Builder 7.2

File

tests/FormBaseTest.php, line 192

Class

FormBaseTest

Namespace

Drupal\form_builder

Code

public function test_getElementsInPreOrder() {
  $form['a'] = $this
    ->eArray('textfield', 'a', 'a', 1);
  $form['fieldset'] = $this
    ->eArray('fieldset', 'fs', 'fieldset');
  $form['fieldset']['b'] = $this
    ->eArray('textfield', 'b', 'b', 0, 'fs');
  $form['fieldset']['c'] = array(
    '#markup' => 'Not a form_builder element',
  );
  $form_obj = new FormBase('webform', 'test', NULL, array(), $form);
  $expected = array(
    'fs',
    'b',
    'a',
  );
  $this
    ->assertEqual($expected, array_keys($form_obj
    ->getElementsInPreOrder()));
}