You are here

public function FormBuilderFormBaseTest::testChangeElementKey in Form Builder 7

File

tests/FormBuilderFormBaseTest.php, line 170

Class

FormBuilderFormBaseTest

Code

public function testChangeElementKey() {
  $a['#type'] = 'textfield';
  $a['#form_builder'] = array(
    'element_id' => 'A',
  );
  $form_obj = new FormBuilderFormBase('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);
}