public function FormBaseTest::test_unsetElementArray in Form Builder 7.2
@covers \Drupal\form_builder\FormBase::getElementIds @covers \Drupal\form_builder\FormBase::unsetElement @covers \Drupal\form_builder\FormBase::unindexElements
File
- tests/
FormBaseTest.php, line 85
Class
Namespace
Drupal\form_builderCode
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 FormBase('webform', 'test', NULL, array(), $form);
$this
->assertEqual(array(
'A',
'B',
), $form_obj
->getElementIds());
$form_obj
->unsetElement('A');
$this
->assertEqual(array(), $form_obj
->getElementIds());
}