You are here

public function FormBuilderAdminTest::testChangingGroupsInElement in Form Builder 7

Test: Elements can change the tabs displayed on their configure form.

File

tests/FormBuilderAdminTest.php, line 28

Class

FormBuilderAdminTest

Code

public function testChangingGroupsInElement() {
  $loader = FormBuilderLoader::instance();
  $fields = $loader
    ->getElementTypeInfo('webform', 0);
  $a = $fields['textfield']['default'];
  $a['#form_builder']['element_id'] = 'A';
  $a['#key'] = 'a';
  $a['#type'] = 'textfield';
  $a['#weight'] = 0;
  $element_id = $this->form
    ->setElementArray($a);
  $this->form
    ->save();
  $form_state = [];
  $form = form_builder_field_configure([], $form_state, 'webform', 'test', $element_id);
  $form['#property_groups']['test'] = [
    'title' => 'Test',
    'weight' => 0,
  ];
  $form['size']['#form_builder']['property_group'] = 'test';
  $form = form_builder_field_configure_pre_render($form);
  $this
    ->assertArrayHasKey('test_property_group', $form);
  $this
    ->assertEqual('Test', $form['test_property_group']['#title']);
  $this
    ->assertArrayHasKey('size', $form['test_property_group']);
}