function WebformLocalizationWebTestCase::createWebformForm in Webform Localization 7
Same name and namespace in other branches
- 7.4 tests/webform_localization.test \WebformLocalizationWebTestCase::createWebformForm()
Create a webform node with test components.
2 calls to WebformLocalizationWebTestCase::createWebformForm()
- WebformLocalizationApiTestCase::testWebformLocalizationApi in tests/
webform_localization.test - Test submissions API function with webform localization presence.
- WebformLocalizationStringTranslationTestCase::testWebformLocalizationStringTranslation in tests/
webform_localization.test - Test creating a webform and enabling localization by string translation
File
- tests/
webform_localization.test, line 120 - Webform localization module tests.
Class
- WebformLocalizationWebTestCase
- @file Webform localization module tests.
Code
function createWebformForm() {
if (isset($this->_webform_node)) {
return $this->_webform_node;
}
$settings = array(
'type' => 'webform',
'language' => 'en',
'uid' => '1',
'status' => '1',
'promote' => '1',
'moderate' => '0',
'sticky' => '0',
'tnid' => '0',
'translate' => '0',
'title' => 'Webform title in english',
'body' => array(
'en' => array(
array(
'value' => 'Donec placerat. Nullam nibh dolor, blandit sed, fermentum id, imperdiet sit amet, neque. Nam mollis ultrices justo.
Sed tempor. Sed vitae tellus. Etiam sem arcu, eleifend sit amet, gravida eget, porta at, wisi. Nam non lacus vitae ipsum viverra
pretium. Phasellus massa. Fusce magna sem, gravida in, feugiat ac, molestie eget, wisi. Fusce consectetuer luctus ipsum.
Vestibulum nunc. Suspendisse dignissim adipiscing libero. Integer leo. Sed pharetra ligula a dui. Quisque ipsum nibh,
llamcorper eget, pulvinar sed, posuere vitae, nulla. Sed varius nibh ut lacus. Curabitur fringilla. Nunc est ipsum,
retium quis, dapibus sed, varius non, lectus. Proin a quam. Praesent lacinia, eros quis aliquam porttitor, urna lacus
volutpat urna, ut fermentum neque mi egestas dolor.',
),
),
),
'teaser' => array(
'en' => array(
array(
'value' => 'Donec placerat. Nullam nibh dolor, blandit sed, fermentum id, imperdiet sit amet, neque. Nam mollis ultrices justo.
Sed tempor. Sed vitae tellus. Etiam sem arcu, eleifend sit amet, gravida eget, porta at, wisi. Nam non lacus vitae ipsum
viverra pretium. Phasellus massa. Fusce magna sem, gravida in, feugiat ac, molestie eget, wisi. Fusce consectetuer luctus
ipsum. Vestibulum nunc. Suspendisse dignissim adipiscing libero. Integer leo. Sed pharetra ligula a dui. Quisque ipsum nibh,
ullamcorper eget, pulvinar sed, posuere vitae, nulla. Sed varius nibh ut lacus. Curabitur fringilla.',
),
),
),
'log' => '',
'format' => '1',
'webform' => array(
'confirmation' => 'Thanks!',
) + webform_node_defaults(),
);
$components = $this->wtc
->testWebformComponents();
/*
* @todo : We need further debug to find how to support
* this components or why are they breaking everything
*/
unset($components['select_no_default_zero']);
unset($components['radios_zero']);
unset($components['select_zero']);
unset($components['select_optgroup']);
$cid = 0;
foreach ($components as $key => $component_info) {
$cid++;
$settings['webform']['components'][$cid] = $component_info['component'];
$settings['webform']['components'][$cid]['cid'] = $cid;
$settings['webform']['components'][$cid]['pid'] = 0;
}
$this->_webform_node = $this
->drupalCreateNode($settings);
return $this->_webform_node;
}