You are here

public function AdminTest::testChangingGroupsInElement in Form Builder 7.2

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

File

tests/AdminTest.php, line 30

Class

AdminTest

Namespace

Drupal\form_builder

Code

public function testChangingGroupsInElement() {
  $loader = Loader::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']);
}