You are here

public function ExamplesTest::testOptionsConfiguration in Form Builder 7.2

File

examples/tests/ExamplesTest.php, line 17

Class

ExamplesTest

Namespace

Drupal\form_builder_examples

Code

public function testOptionsConfiguration() {
  module_load_include('inc', 'form_builder', 'includes/form_builder.admin');
  $loader = Loader::instance();
  $form = $loader
    ->getForm('example', 'test', 'testsid');
  $form
    ->save();
  $data = _form_builder_add_element('example', 'test', 'select', NULL, 'testsid', TRUE);
  $options_id = $data['elementId'];
  $form = $loader
    ->fromCache('example', 'test', 'testsid');
  $e = $form
    ->getElement($options_id);
  $form_state = array();
  $form = $e
    ->configurationForm(array(), $form_state);
  $this
    ->assertEqual(array(
    1 => 'one',
    2 => 'two',
    3 => 'three',
  ), $form['options']['#options']);
}