You are here

public function FormBaseTest::testChangeElementKey in Form Builder 7.2

File

tests/FormBaseTest.php, line 172

Class

FormBaseTest

Namespace

Drupal\form_builder

Code

public function testChangeElementKey() {
  $a['#type'] = 'textfield';
  $a['#form_builder'] = array(
    'element_id' => 'A',
  );
  $form_obj = new FormBase('webform', 'test', NULL, array(), array(
    'a' => $a,
  ));
  $a['#key'] = 'b';
  $form_obj
    ->setElementArray($a);
  $form = $form_obj
    ->getFormArray();
  $this
    ->assertArrayHasKey('b', $form);
  $this
    ->assertArrayNotHasKey('a', $form);
}