You are here

public function FormBaseTest::testElementIdIndexing in Form Builder 7.2

@covers \Drupal\form_builder\FormBase::__construct @covers \Drupal\form_builder\FormBase::indexElements

File

tests/FormBaseTest.php, line 100

Class

FormBaseTest

Namespace

Drupal\form_builder

Code

public function testElementIdIndexing() {
  $form['a']['#type'] = 'textfield';
  $form['a']['#form_builder'] = array(
    'element_id' => 'A',
  );
  $form['a']['b'] = array(
    '#type' => 'textfield',
  );
  $form['a']['b']['#form_builder'] = array(
    'element_id' => 'B',
  );
  $form_obj = new FormBase('webform', 'test', NULL, array(), $form);
  $this
    ->assertNotEmpty($form_obj
    ->getElementArray('A'));
  $this
    ->assertNotEmpty($form_obj
    ->getElementArray('B'));
}