You are here

public function WebformTestCase::webformForm in Webform 7.4

Create a sample Webform node.

Parameters

array $webform_settings: Settings to use for this form. Any unspecified settings will be default.

7 calls to WebformTestCase::webformForm()
WebformComponentsTestCase::testWebformComponents in tests/WebformComponentsTestCase.test
Webform module component tests.
WebformPermissionsTestCase::testWebformSubmitAccess in tests/WebformPermissionsTestCase.test
Create a webform node in which authenticated users have access to submit.
WebformSubmissionTestCase::testWebformSubmissionComponentLength in tests/WebformSubmissionTestCase.test
Test length validation.
WebformSubmissionTestCase::testWebformSubmissionDownload in tests/WebformSubmissionTestCase.test
Test that the correct submissions are offered for download.
WebformSubmissionTestCase::testWebformSubmissionRequiredComponents in tests/WebformSubmissionTestCase.test
Test that required fields with no default value can't be submitted as-is.

... See full list

File

tests/WebformTestCase.test, line 995

Class

WebformTestCase
Webform module tests.

Code

public function webformForm(array $webform_settings = array()) {
  if (isset($this->_webform_node)) {
    return $this->_webform_node;
  }
  $settings = array(
    'type' => 'webform',
    'language' => LANGUAGE_NONE,
    'uid' => '1',
    'status' => '1',
    'promote' => '1',
    'moderate' => '0',
    'sticky' => '0',
    'tnid' => '0',
    'translate' => '0',
    'title' => 'Test Webform',
    'log' => '',
    'format' => '1',
    'webform' => $webform_settings + array(
      'confirmation' => 'Thanks!',
    ) + webform_node_defaults(),
  );
  $cid = 0;
  foreach ($this
    ->webformComponents() 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;
}