function FormBuilderWebformFormTest::testPreview in Form Builder 7
File
- modules/
webform/ tests/ FormBuilderWebformFormTest.php, line 79
Class
Code
function testPreview() {
$form = new FormBuilderWebformForm('webform', 0, 'the-sid', array(), array());
$form
->addComponents($this->components);
$this
->assertEqual($form
->preview(), array(
'#tree' => TRUE,
'fieldset1' => array(
'#type' => 'fieldset',
'#title' => 'fieldset1',
'#title_display' => NULL,
'#weight' => '0',
'#description' => '',
'#collapsible' => 0,
'#collapsed' => 0,
'#attributes' => array(
'class' => array(
0 => 'webform-component-fieldset',
),
),
'#pre_render' => array(
0 => 'form_pre_render_fieldset',
1 => 'ctools_dependent_pre_render',
2 => 'form_builder_pre_render',
),
'#translatable' => array(
0 => 'title',
1 => 'description',
),
'#webform_component' => array(
'nid' => 1,
'cid' => '1',
'pid' => '0',
'form_key' => 'fieldset1',
'name' => 'fieldset1',
'type' => 'fieldset',
'value' => '',
'extra' => array(
'title_display' => 0,
'private' => 0,
'collapsible' => 0,
'collapsed' => 0,
'conditional_operator' => '=',
'description' => '',
'conditional_component' => '',
'conditional_values' => '',
),
'mandatory' => '0',
'weight' => '0',
'page_num' => 1,
),
'hour' => array(
'#type' => 'webform_time',
'#title' => 'hour',
'#title_display' => 'before',
'#required' => '0',
'#weight' => '2',
'#description' => '',
'#element_validate' => array(
0 => 'webform_validate_time',
),
'#hourformat' => '12-hour',
'#minuteincrements' => '1',
'#default_value' => '',
'#timezone' => 'user',
'#process' => array(
0 => 'webform_expand_time',
),
'#theme' => 'webform_time',
'#theme_wrappers' => array(
0 => 'webform_element',
),
'#translatable' => array(
0 => 'title',
1 => 'description',
),
'#webform_component' => array(
'nid' => 1,
'cid' => '3',
'pid' => '1',
'form_key' => 'hour',
'name' => 'hour',
'type' => 'time',
'value' => '',
'extra' => array(
'timezone' => 'user',
'title_display' => 'before',
'private' => 0,
'hourformat' => '12-hour',
'minuteincrements' => '1',
'conditional_operator' => '=',
'description' => '',
'conditional_component' => '',
'conditional_values' => '',
),
'mandatory' => '0',
'weight' => '2',
'page_num' => 1,
),
'#form_builder' => array(
'element_id' => 'cid_3',
'element_type' => 'time',
'form_type' => 'webform',
'form_id' => 0,
'parent_id' => 'cid_1',
'configurable' => TRUE,
'removable' => TRUE,
),
'#pre_render' => array(
0 => 'form_builder_pre_render',
),
'#key' => 'hour',
),
'#form_builder' => array(
'element_id' => 'cid_1',
'element_type' => 'fieldset',
'form_type' => 'webform',
'form_id' => 0,
'parent_id' => 0,
'configurable' => TRUE,
'removable' => TRUE,
),
'#key' => 'fieldset1',
),
'textfield1' => array(
'#type' => 'textfield',
'#title' => 'textfield1',
'#title_display' => 'before',
'#default_value' => 'textfield1',
'#required' => '0',
'#weight' => '1',
'#field_prefix' => 'testprefix',
'#field_suffix' => 'testpostfix',
'#description' => '',
'#attributes' => array(),
'#theme_wrappers' => array(
0 => 'webform_element',
),
'#translatable' => array(
0 => 'title',
1 => 'description',
2 => 'field_prefix',
3 => 'field_suffix',
),
'#disabled' => TRUE,
'#size' => '4',
'#webform_component' => array(
'nid' => 1,
'cid' => '2',
'pid' => '0',
'form_key' => 'textfield1',
'name' => 'textfield1',
'type' => 'textfield',
'value' => 'textfield1',
'extra' => array(
'title_display' => 'before',
'private' => 0,
'disabled' => 1,
'unique' => 0,
'conditional_operator' => '=',
'width' => '4',
'maxlength' => '',
'field_prefix' => 'testprefix',
'field_suffix' => 'testpostfix',
'description' => '',
'attributes' => array(),
'conditional_component' => '',
'conditional_values' => '',
),
'mandatory' => '0',
'weight' => '1',
'page_num' => 1,
),
'#form_builder' => array(
'element_id' => 'cid_2',
'element_type' => 'textfield',
'form_type' => 'webform',
'form_id' => 0,
'parent_id' => 0,
'configurable' => TRUE,
'removable' => TRUE,
),
'#pre_render' => array(
0 => 'ctools_dependent_pre_render',
1 => 'form_builder_pre_render',
),
'#key' => 'textfield1',
),
'#form_builder' => array(
'form_type' => 'webform',
'form_id' => 0,
'sid' => 'the-sid',
),
));
}