You are here

public function FormBuilderFormBaseTest::test_unsetElementArray in Form Builder 7

@covers FormBuilderFormBase::getElementIds @covers FormBuilderFormBase::unsetElement @covers FormBuilderFormBase::unindexElements

File

tests/FormBuilderFormBaseTest.php, line 83

Class

FormBuilderFormBaseTest

Code

public function test_unsetElementArray() {
  $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 FormBuilderFormBase('webform', 'test', NULL, array(), $form);
  $this
    ->assertEqual(array(
    'A',
    'B',
  ), $form_obj
    ->getElementIds());
  $form_obj
    ->unsetElement('A');
  $this
    ->assertEqual(array(), $form_obj
    ->getElementIds());
}